We measure the distance to nearby stars by how much they shift over the period of a year as the Earth moves around the Sun in its orbit. This is our most accurate distance measurement for objects outside of the solar system.