If you know the size of an object, like a car or a person, you can intuitively guess how far away it must be for it to look as small as you see it. This method does not help you if you have no clues as to the size of an object. However, if you are looking at a group of things that you think might all be about the same size, you can say something about how far away they might be, on average. The closer the objects are to all being the same size, the more likely you are to be right when you use this technique. However, if you assume all cars are the size of a VW Beetle, you will greatly mistake the distance to a mack truck! This technique can be used on galaxies and globular clusters to some extent, but the size range in these objects introduce large uncertainties.
Similarly, if you know how bright a source of light is, you can easily figure how far away it is. However, this is also problematic when you don't know the source. On a dark night at sea, is that dim point on the horizon a far-off lighthouse or a nearby lantern? A mistake could mean life or death. In astrophysics, the stakes are not quite that high, but we still search for "standard candles", or sources of light that give off the same amount of brightness, no matter where they are. Without these, we must (like with sizes) take averages, and accept that we just won't know about individual sources.
If you can see with both eyes, you can use the triangulation effect known as "parallax" to estimate a distance. The closer an object is to you, the more different it will look from each eye; your brain processes the differences in the images it receives from each eye and constructs a 3-d picture of what you're seeing. This is how 3-d movies fool your brain: by sending a different image to each eye such that objects that they want you to see close up look the most different between the images. If you hold your finger up in front of your face and look at it with one eye at a time, you can see it shift relative position. At full-arm's length, the relative shift will be smaller. The further away something is, the less able you are to tell the difference between how your two eyes see it, and hence the less able you are to tell just how far away it is.
Although your eyes are certainly too close together to tell the difference between stars, we can create a similar effect to closing one eye at a time by taking pictures of the sky six months apart. Since the Earth takes twelve months to orbit the sun, images taken six months apart give the maximum possible separation between the two images, and when they are combined, nearby stars can be seen to have shifted. With the most accurate telescopes available, this technique can be used to measure the distances to stars out to a few hundred light years.
Beyond that, we have to take steps up a cosmic distance ladder. By comparing nearby stars to distant stars that are similar, we can infer their distance. By looking at how those stars are distributed around the Galaxy, we can infer the size of the Galaxy (about 100,000 light years across). If we assume other galaxies are about the same size as our own, we can estimate the distances to the nearest ones (millions of light years).
However, if we want to go beyond that, we really need a standard candle. The two most useful standard candles are Cepheid variable stars and Type Ia Supernovae. Cepheids are stars that have a periodic cycle in their brightness, and this cycles is such that the brighter their average brightness is, the faster they pulse through their cycles. Therefore, if you measure how fast they are pulsing, you can determine how bright they are, which in turn tells you how far away they are when you measure how much dimmer than that they look. Type Ia Supernovae are colossal explosions that always reach the same peak brightness. By measuring how bright they look at peak, from the earth, we can calculate how far away they are.
It is these measurements that allow us to determine the distance scale across the billions of light years that separate us from the distant galaxies.