How do we know the distance of stars? If we look east and see a star that is 100 million light years away, then look west and see a star that is 500 millions years away, how can we tell the difference?
Astronomers have different scientific methods to calculate distance to stars.
Near bye stars.stellar parallax.
standard candles. variable stars.
Type !a supernova.
for details read Wikipedia cosmic distance ladder.\