Despite their appearance, the tiny red worms in your pond aren't actually worms: they're midge larvae. Better known as bloodworms, these small creatures are juveniles that will develop into adult midges. Although they are harmless, they can sometimes be a nuisance.
Midges feed on microscopic organisms and dead plant matter accumulating in the pond. They owe their red color to the same kind of protein you have in your red blood cells, an iron-binding protein called hemoglobin. They can survive in low-oxygen conditions and thus prefer stagnant or still water. Typically you'll see them at the bottom of the pond feeding on debris. Once they pupate or metamorphose, they will swim to the surface and emerge as adult midges; the midges in turn lay their eggs in the pond water, completing the cycle.
Midges can sometimes resemble mosquitoes but most species do not bite, so there is no need to fear them. In large numbers, however, they can become a nuisance, especially on account of the loud humming noise they make. If you begin to find midges from your pond are infiltrating or infesting your house, it may be time to take action to bring the problem under control.
Some species of fish feed on midge larvae and can act as a highly effective kind of biocontrol for midge populations. Nutrient-rich habitats, like ponds that receive fertilizer-laden runoff, are especially likely to support midge populations, so reducing the amount of nutrients entering the water can help. Adding insecticides will kill midge larvae but will also kill many other beneficial organisms in the water and can be hazardous to human health, so only make use of insecticides as a last resort. Remember that in small numbers midge larvae are actually beneficial; they play an important role in the pond ecosystem by helping to clean up the muck. If they are only present in small numbers, there's no reason to regard them as a problem.