There are many ways to solve this problem: Thales theorem, trigonometry, projection of vectors, etc. But the most basic issue here is how humans see. At an individual eye level, we dont see distance. We see points, and its angular position. The key word here is angular: if I put my finger so it blocks the sun, part of the figer is on the same angular position/s as the sun. When we have two objects, we see their distance as angular distance, not linear. Nature, of course, finds a way: given two points of view at a known distance, we can paralax track the distance using basic trigonometry that the brain does for us. This method doesnt spit a number, though, only a sense of distance. In order to calculate the precise distance, we can do paralx calculations on a large scale, or we can use thalos theorem to calculate the lenght of the projected triangle. Euclidian basic stuff that the greeks knew about thousands of years ago, really.