Species of fly that occur indoors are generally considered nuisance insects rather than safety hazards, though some of the species that occur indoors are capable of transmitting diseases to humans. If indoor flies find a source of moisture inside your home to sustain their survival, they are likely to live and breed in that area of the home as long as they can, meaning that you may encounter the larval as well as the adult species of the fly.
Drain flies are among the most commonly occurring indoor nuisance flies. Drain flies earn their name because they always inhabit moist areas, particularly areas with contaminated water that has been standing for some time. Therefore, drain flies are more likely to be found in kitchens, bathrooms and any other rooms in the home that have standing water that may be contaminated with decaying organic matter, sewage, bacteria and other microorganisms, algae and sediment.
Given their proclivity for moist environments, a rather bizarre though not uncommon occurrence in residences is finding drain fly larvae that closely resemble black worms in toilets and drains. Adult drain flies prefer to breed in standing water, and larvae will stay in the water, feeding on contaminants until they pupate into adult form, a process that typically takes nine to 15 days.
As is usually the case with indoor insect pests, control methods should be focused not only on removing the pests that have already made their way indoors, but on preventing more pests from coming indoors as well. Of course, if drain fly larvae are in the toilet, you can simply flush them, but keep in mind that whatever drove them to the toilet water in the first place will likely attract more flies. If more drain fly larvae show up in your toilet water, deep-clean the toilet and the drain at the bottom of the toilet, if necessary, with a "snake" to clear any decaying organic matter deep in the drain that may be attracting the drain flies.
Several chemicals can be deployed against drain flies to help rid your house of adult and larval drain flies. Bacteria complex cleaning agents are sold in gel form and can be used to break down organic matter and other contaminants that attract drain flies into your home. Some chemical pesticides containing pyrethrin or resmethrin can be used to kill adult drain flies. Again, more drain flies are likely to travel into the home until the contaminants attracting them inside in the first place are removed.