In a vacuum, all electromagnetic waves, including light of different wavelengths, travel at the same speed, which is the speed of light (approximately 299,792,458 meters per second). This fundamental property of electromagnetic waves is described by Maxwell's equations and is a fundamental principle of physics.
The Doppler effect can be explained within this framework by considering the relative motion between the source of the wave and the observer. The Doppler effect is a change in the observed frequency (and hence wavelength) of a wave due to the relative motion between the source and the observer.
When a wave source is moving towards an observer, the wavelengths of the emitted waves are compressed, resulting in a higher frequency and a phenomenon known as "blueshift." Conversely, when a wave source is moving away from an observer, the wavelengths of the emitted waves are stretched, resulting in a lower frequency and a phenomenon known as "redshift."
Importantly, the Doppler effect is related to the relative motion between the source and observer, rather than any inherent change in the speed of light or the different speeds of different wavelengths of light. The observed change in frequency or wavelength is a consequence of the relative motion and the wave nature of light, even though all wavelengths of light travel at the same speed in a vacuum.
It's worth noting that in other mediums, such as air or water, the speed of light is slightly slower than in a vacuum. In these cases, different wavelengths can experience different speeds, leading to effects like dispersion. However, the fundamental principles of the Doppler effect and the constant speed of light still hold true, with the observed frequency or wavelength changes being a result of relative motion rather than different speeds of light waves themselves.