If z is calculated using the ratio between observable wavelength and emitted wavelength, how do we know the emitted wavelength of a star that is moving away from us? Wouldn’t we have to be at a constant distance from the star to know that value?
The light emitted by stars passes through various gases, these gases absorb very specific wavelengths of light. For example Hydrogen will absorb light at exactly 6563 Å. So we know that the spectrum of light would have a dark line at 6563 Å if the galaxy wasn't moving away from us.
If the light is redshifted, this line also gets redshifted. So if this line appears at 7830 Å, we can calculate the redshift.
Because gases absorb (and emit) light at particular known wavelengths, we do know emitted wavelength of the light.