There are various methods used in conjunction. This is called “[cosmic distance ladder](https://en.wikipedia.org/wiki/Cosmic_distance_ladder)”. As others have said, parallax is one of the methods, light redshift is another, but there are many more.
The main problem is to have a reliable method that is common enough to be widely used, but also for them to overlap, so we can count on others when the method becomes unreliable.
Latest Answers