An expanding universe makes measuring distance more complicated because space does not remain fixed while light travels through it. Galaxies continue to emit light, but that light may spend billions of years crossing the cosmos before reaching us. During that journey, the universe keeps expanding, increasing the average separation between galaxies (yes, I know that sometimes galaxies can collide, but we're talking on average, at big scales here).
This means that when a telescope captures the light from a distant galaxy, the image does not reveal where that galaxy is today. It shows the galaxy as it appeared when the light began its journey. To estimate its present distance, astronomers must use a cosmological model that accounts for how the universe has expanded over time.
The leading model used today is called LCDM. It includes dark matter (different episode) and dark energy (different episode). The strengths and limitations of LCDM are worth discussing separately (different episode), but alternative models do not significantly change the overall picture described here.
The Edge of the Observable Universe
The universe is about 13.77 billion years old, but the most distant regions we can observe are now roughly 45 billion light-years away. Space expanded during the entire time that their light was traveling toward us.







