I understand how to interpret a H-R diagram, in the sense that I know that the upper right top corner is occupied by cool stars, but they are very luminous so they must be big; and the bottom left corner are hot stars, not luminous, so they are small in size. However, I have tried to read a textbook and look online, but have yet to understand how from this information, we can measure the distance to stars of undefined distance.
There are two main techniques that I know of for using HR diagrams to measure distance. The first is to, basically, plot a group of stars that were likely all formed at the same time (that is, a cluster) with apparent brightness against color. Because the stars are all in the same cluster, they are at nearly the same distance. So you can find the distance to the cluster by finding how much you have to shift the diagram up or down to get it to line up with either a similar HR diagram of a cluster at a known distance or an HR diagram of stars with parallax distances.
The second way is called "tip of the red giant branch", typically used with galaxies where the main sequence won't be as well defined as it is for single clusters. As a star ages it moves through the HR-diagram on paths at different rates. Most of the star's lifetime is spent on the line where it burns hydrogen in its core, known as the "main sequence". As the fusing layer expands due to the growth of the inert core in the center, the star moves up and to the right (brighter and redder) on the diagram. For stars with mass less than around 1.6 times the sun's, the pressure and temperature eventually get high enough that helium begins fusing, in a process called the helium flash, causing the core to expand and cool, making the outer layers of the star contract. That moves the star back down and to the left in the HR-diagram, leaving a kind of "cusp" in the path through the HR diagram. The location of that cusp is called the "tip of the red giant branch". Because we know the luminosity and color of that tip, when we find it on an HR diagram of stars in a galaxy, we can work out a lot of information about the galaxy (redshift, distance, etc).
You can use an HR diagram along with calibrated evolutionary models to find the distance (and in some cases, mass and age) of individual stars. The method is known as spectroscopic parallax. This is a confusing name because it is not a parallax measurement at all.
The technique is to use spectroscopy, or less precisely the colours, of a star to estimate it's effective temperature and surface gravity. This can normally be used to get a good idea of what kind of star (dwarf, giant and spectral type). This is enough to locate it in the HR diagram and determine the absolute luminosity. From there, the apparent brightness of the star yields its distance.
The technique works best for main sequence stars. Other types have quite age-dependent positions in the HR diagram and since this isn't known and also because the gravity is not usually accurate enough to pin down the exact HR diagram position (although it is usually good enough to distinguish a main sequence star from a giant or subgiant), it doesn't work as well.
Another simple description of this technique, with examples, is given here.