When we see a galaxy through a telescope, say the James Webb telescope, it is said we see a galaxy as much as about 10 billion light years away. But 10 billion years ago we were much closer (because the universe was less than 4 billion years old) and now we are much further apart because of the expansion of the universe.
How do we know what distance the light had to travel to get here? Ten billion years ago the Earth did not even exist. If we use the Hubble relationship to calculate distance, that would be based on the red shift 10 billion years ago. The Earth formed 5.3 billion years later because the Earth is about 4.7 billion years old.