The space between stars is not quite empty. Along with thin gas, it holds tiny solid grains of dust, mostly silicates and carbon compounds, about 0.1 μm across or smaller. Dust dims every star behind it, and it changes the distance modulus: if you forget it, a star looks farther away than it is.
💡 Why it works
A grain blocks light most effectively when it is about as large as the wavelength or larger. Interstellar grains are comparable to visible wavelengths, so they scatter and absorb short (blue) wavelengths more strongly than long (red) ones; in the visible, the dimming grows roughly as $1/\lambda$. So dust does two things at once. It makes a star fainter (extinction), and because more blue than red light is removed, it makes the light that gets through look redder (reddening). Dust does not erase or move a star's absorption lines, so the spectrum still tells the star's true temperature.
🔑 Key idea
Extinction $A_V$ (in magnitudes) adds to the distance modulus: $$m - M = 5\log_{10}\frac{d}{10\text{ pc}} + A_V.$$ Reddening is the color excess $E(B - V) = (B - V)_{\text{observed}} - (B - V)_0$, and for typical dust in the Milky Way $A_V \approx 3.1\,E(B - V)$.
That last relation is what makes extinction measurable. The spectral lines give the true color $(B - V)_0$ of a star of that type; the photometry gives the observed color; the difference is the reddening, and 3.1 times it is the dimming in the $V$ band.
A 10,000 K star seen through dust. The shaded bands are the B and V filters. Dust removes more blue than red, so the star gets fainter and its $B - V$ grows.
Worked examples
✏️ Worked example: Correcting a distance for dust
A star has $m_V = 12.0$ and $M_V = 2.0$, and dust dims it by $A_V = 1.5$ mag. How far away is it? How far would you have said if you ignored the dust?
$5\log_{10}(d/10\text{ pc}) = m - M - A_V = 12.0 - 2.0 - 1.5 = 8.5$.
Infrared and radio waves, much longer than the grains, pass through with far less loss.
Answer: A factor of about a trillion, so astronomers study the galactic center in infrared, radio and X-rays.
⚠️ Common mistake
Taking a reddened star to be a cool star. A hot B star seen through thick dust can have the $B - V$ of a cool G or K star. If you read its temperature from color alone, you get it wrong; if you then use a cool star's luminosity, its distance is wrong too. Check the spectral lines: dust reddens the continuum but leaves the pattern of lines, which tells the true temperature, unchanged.
The setting Sun is reddened in the same direction for a related reason: air molecules scatter blue light much more than red. The particles and the wavelength dependence differ, but in both cases the blue is removed from the direct beam.
Practice
Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.