Space is big, really big, way bigger than any of us can really comprehend. On Earth, we use measurements such as metres and kilometres. These will be sufficient for some features on the planets and moon or moons like craters and mountains. Consider the distance from the Sun to Neptune which is about 4,498,396,441 km. This is quite a mouthful and is actually only a short distance in the cosmos. These situations necessitate the need for another unit of measurement.
For situations like this, we switch to a different system of units. The first of these units is called an astronomical unit. This unit is useful to measure distances in the System System. The astronomical unit, also called an AU is the distance from the Earth to the Sun, i.e. 1 AU = 150 million km approx. We can then represent all of the distances in the Solar System using this system. Measured in astronomical units, Neptune is 30 AU from the Sun. A much more manageable number.
This is fine for measuring distance between planets but what about measuring the distances between stars? The closest start to the Sun is called Proxima Centuri. This star is about 40,208,000,000,000 km away, or about 268,770 AU. Kilometres are not practical in this situation and while astronomical units could be used, this is the closest star to Earth so the number is only going to go up from there. For the distances between stars, we use a unit called the light year. Sometimes light years are confused as a measure of time and not distance. The light year is the distance that a light beam travels in 1 year. Light travels at 300,000 km per second so this is a very large distance. Using this unit of measure, we can say the Proxima Centuri is 4.3 light years away. For context, our Milky Way is about 100,000 light years in width.
Astronomers generally use light years until the distances grow into the hundreds of thousands of light years. When the distances get bigger than this, they use parsecs. The process of how a parsec is calculated is quite complicated. It is based on trigonometry and the movement of the stars against the celestial sphere. It works out at approximately 3.26 light years. Astronomers can also use megaparsecs, in which each megaparsec is 1 million parsecs.
There is one final distance measurement. When an object is so far away that even megaparsecs are not big enough, astronomers use something called red shift. Red shift is where the colour of light from an object gets shifted to the red end of the spectrum by the expansion of he universe.
In summary, in our toolkit for measuring cosmic distances we have the astronomical unit, the light year, the parsec, the mega parsec and red shift. I did say the universe was big!