Oh okay yeah if some tasks are subtasks that explains it.
Subtasks do not belong to the project natively hence why they are not sorted here either.
I mean you could multi-select those and add them to the project also but then they will basically show twice in list view.
Here is an existing feedback request thread that I recommend upvoting: Display subtasks on List view when project is filtered/sorted