1.16.5, 1.18.2 Pre-release 1
It seems like the game checks all locations from y=255 down to y=1, but doesn't seem to check y=0.
1. Go to the End.
2. Kill the ender dragon.
3. Go into the first end gateway, and you'll come to the second end gateway which generates on the end islands (Or you can generate it in the middle of the void with the right setup)
4. Make sure there are no blocks whose x or z coordinates are 5 meters away from the second end gateway.
5. Put a solid block at y=0. This should be the only block within 5 meters of the second end gateway, so we should expect the player to spawn here.
6. Go back through the second end gateway and then the first end gateway.
7. Your player will spawn 2 meters above the second end gateway, which means that the game wasn't able to find the block that you put at y=0.
8. Now put a solid block at y=1. Repeat step 6.
9. Now your player will spawn at the solid block that you put at y=1.
The gateway didn't check if their was a valid block at y = 0
The gateway would check if a valid block exist at y = 0