Fungus gnats (Bradysia paupera now known as Bradysia difformis) (syn. sciarid flies) are small (3 mm) black flies which like to hang around damp compost. The flies are not a problem, however the tiny silvery, transparent worm like larvae often are, since they will eat the roots, leaves (at ground level) and bulbs of seedlings causing fatal damage.
Blame is usually directed at over watering of peat based compost. There is some debate over control; simple methods like topping pots with sand or letting compost dry out work for some people but not for others (fungus gnats like damp sand and letting the compost dry merely encourages the larvae to feast on the still moist plants).
Other methods are: breaking different stages of the life cycle, insecticide drenches and nematodes for compost to attack the larvae, and yellow sticky traps and contact insecticides for the flies. Bacteria based 'Mosquito dunks' are often recommended or products containing Bacillus thuringiensis (BT). Carnivorous plants like Pinguicula grandiflora also work but miss the peak in fly numbers in early Autumn.
Photographs by David Pilling. The last two show the larvae, visible are the black head and digestive tract. The first larvae photo and video show an area of height 10 mm. The lines in the second larvae photo are 1 mm apart; given their size and transparency the larvae are only just visible with the naked eye. The final photo shows larvae in their natural environment. See if you can spot both of them.
Since it is difficult to see the transparent body in a picture, this video clip may be easier to understand.
Click here to see PBS list postings about fungus gnats.