It is useful to recall how the distances are measured for various astronomical objects. This information can be found in any standard textbook. The simplest and the most direct method is the trigonometric parallax: a stellar position in the sky varies while the earth orbits the sun. With modern instruments stellar distance can be measured this way out to parsecs. This is a purely geometrical method.
A so called dynamical parallax is applicable to binaries for which spectroscopic orbits can be combined with the astrometric orbits. The geometry of orbital motion is measured in two ways, with spectroscopy and astrometry providing us with the linear and angular dimensions, respectively, and their ratio gives the distance to the binary.
Another purely geometrical method uses the apparent proper motions and radial velocities of a group of stars which cover a large area in the sky, like the Hyades cluster. A combination of the observed range of proper motions and radial velocities across the moving group allows the distance to be measured.
A purely geometrical method which works on a truly cosmological scale is based on gravitational lensing: the two images of a distant quasar are seen along the two different paths, and the light travel time is different along the two. If the brightness of the lensed quasar varies then the time lag between the observed variation of the two images is equal to the difference in the two path lengths divided by the speed of light. Other things being equal the time delay is proportional to the distance.
There are many simple but indirect geometrical methods known. If a new object appears to be associated with another, with a know distance, then the distance to the new source becomes known as well. An example is a BL Lac type object with a featureless spectrum observed to be at the center of a galaxy with a known redshift.
If a new source is found to be behind a known object then its distance must be larger. An example is another BL Lac object with the absorption lines in its spectrum observed to be at the same redshift as a galaxy which is seen in the same direction: the BL Lac object must be behind the galaxy.
A powerful method of distance determination is based on the observed distribution of sources - this is another purely geometrical approach, described in the next section.
The only physical method which works well deals with thermal sources which are optically thick, and therefore radiate like a black body, or like a somewhat distorted black body. The observed spectrum is used to estimate the surface temperature, and hence the surface brightness. The radial velocity variations in an eclipsing binary, or in a pulsating star, are used to measure the linear size of the star, and hence its area. The product of the area and the surface brightness is the intrinsic (absolute) stellar luminosity, while the apparent luminosity (the flux) can be measured directly. The ratio of the two is proportional to the square of distance. A popular techniques of this kind is known as Baade-Wesselink.
Many other methods exist, but they are usually related to those which have been described. However, no distance was ever reliably measured to any non-thermal source using any non-thermal models of its emission. Note, that gamma-ray bursts have very broad, non-thermal spectra. No clear association exists between the bursts and any other objects. Inspecting a long list of proven methods we find there is only one which is applicable to gamma-ray bursters: we have to use their observed distribution, as described in the following section.