When a source moves toward you, waves compress and frequency increases; when it moves away, waves stretch and frequency decreases. This applies to sound (changing pitch), and light (changing color, or redshift).
The Cosmic Microwave Background isn’t the edge of space in an infinite universe—it’s the oldest light we can see, marking a boundary in time, not distance.