That depends on how far away something is.
For particularly close objects, we can triangulate and guess the difference by how much its position shifts when viewed from two different points. This is called stellar parallax. It’s essentially the same as crossing the street or climbing a hill to get a slightly different look at a distant object.
For farther away objects, we can guess how far it is by determining what kind of object it is versus how bright it is. For instance, we can look at a distant star and tell from the light reaching us that it is a yellow dwarf like our own sun. Then we can guess from how bright it is (or how dim it is, said a different way) how far away it must be. This is essentially the same as guessing whether someone holding a flashlight is close to you or far away based on how bright or how dim the flashlight seems to you.
For more distant galaxies, we cannot do this by measuring individual stars but we can measure other events, like supernovae (exploding stars) on the same principle.
Finally, for very distant objects, we can use the redshift. Because of cosmic inflation (a whole extra ELI5), the farther away in the universe objects are from us, the faster they are travelling away from us. This causes a noticeable downward shift in the spectrum of light reaching us from those objects, and so we can guess how far away they are based on how redshifted the light is. This is essentially the same as how you can tell whether a loud truck or an emergency vehicle with a siren is travelling towards you or away from you because of how the sound changes as it passes you.
Latest Answers