Stars not on the Main Sequence (not luminosity class V) are NOT currently burning Hydrogen in their cores. They
exist in an advanced stage of stellar evolution.
If we know a stars spectral type and luminosity class, then we
know in principle (see above) what their absolute Visual magnitude
should be. Comparing that to their apparent visual
magnitude tells us the stars distance!
About 10% of stars are found NOT to lie on the Main Sequence (luminosity class V shown below).
Spectroscopic Parallax
This is not a parallax at all, but
is a means of estimating the distance to a star from
its spectral type (OBAFGKM) and luminosity class (V,VI,III,II,I).