Cepheids, also called Cepheid Variables, are stars which brighten and dim periodically. This behaviour allows them to be used as cosmic yardsticks out to distances of a few tens of millions of light-years.
In 1912, Henrietta Swan Leavitt noted that 25 stars, called Cepheid stars, in the Magellanic cloud would brighten and dim periodically. Leavitt was able to measure the period of each star by measuring the timing of its ups and downs in brightness (see first graph).
What she determined was that the brighter the Cepheid, the longer its period. In fact, Cepheids are very special variable stars because their period (the time they take to brighten, dim and brighten again) is regular (that is, does not change with time), and is a linear function of their luminosity. That is, there is relation between the period and luminosity such that once the period is measured, the luminosity can be calculated. (see second graph). Luminosity is usually expressed in comparison to the energy output of the Sun (LSun).
The variation in luminosity is caused by a cycle of ionisation of helium in the star's atmosphere, followed by expansion and deionisation. While ionised, the atmosphere is more opaque to light. This cycle has a period roughly equal to the star's "dynamical time scale", therefore giving information on the mean density of the body as well as its luminosity.
Anyway, we are not worried here so much about the physical explanation; let's leave that to the astronomers. But the key point here is that we have a physical relationship between period (something we can measure) and luminosity (which gives us the opportunity to calculate distance with the inverse square law).
Cepheids are reasonably abundant and very bright. Astronomers can identify them not only in our Galaxy, but in other nearby galaxies as well. This method works up to 13 million light-years when Earth-bound telescopes are used; for larger distances these stars become too dim to be observed.
Recently, space-based telescopes such as the Hubble Telescope, have used these stars to much farther distances. Looking at a galaxy in the Virgo cluster called M100, astronomers used the Cepheid variables observed there to determine its distance - 56 million light-years.
A similar method makes use of stars called RR Lyrae. They are more common than Cepheids, but less luminous.
Therefore they can only be used within our galaxy.