Astronomers have a number of ways to measure the distance to stars. In the case of supernova 1987A, an unusual method could be used.
At an earlier stage in its life, the star which exploded gave off material which formed a ring. Light from the supernova eventually bounced off of this ring, and about a year after we saw the explosion, we suddenly saw the ring.
Now, imagine a triangle. We know one of the angles - the angle, from here, between the supernova and the ring. And we know the length of one side, in years. From that, high school trigonometry gives us the lengths of the other two sides. The distance is 168,000 light years, ± 3.5%.
For details see:
Note that this measurement doesn't depend on the speed of light. As this page points out, the measurement would be correct even if the speed of light has been changing.