While it is true that there are good distance runners who are taller, when looking at the best 5k - marathon runners, the vast majority will be shorter / smaller .
It’s usually the non-running observer who opines that a taller person with long legs must have an advantage because they’ll naturally have a longer stride.
It is interesting that being shorter seems to be preferable in the sprints, but there are several outliers. Then, in the mid-distances, there is not a clear advantage either way. Then, 5k and up, the advantage is for the shorter folks, but with exceptions.
I think it has to do with the forces and torque required for each stride and the great number of strides required for a distance event. I have no idea why the sprints are the way they are, however. Perhaps the shorter people are able to get out faster with their shorter quicker strides. The tallers have a greater top end speed, but it is usually too late. In that case, though, it would seem that tall guys should dominate the 400, but the quarter looks more like the mid-distances, where it is not clear to be advantageous to be shorter or taller.