Wien's displacement law states the following $$\lambda_{max}\propto\frac{1}{T}$$ However, after learning about redshift and blueshift, it doesn't make sense to me why we can use this law. Supposedly, we can predict the temperature of a star given the peak wavelength. However, this wavelength is being observed from earth, so won't this wavelength be subject to redshift or blueshift? It seems to me then, that this displacement law will give only a rough estimate.
How can we use this law, when the wavelength is changing with the expansion of the universe?