Drought, rising temperatures, and expanding human populations are increasing water demands. Many countries are extending potable water supplies by irrigating crops with wastewater. Unfortunately, wastewater contains biologically active, long-lived pharmaceuticals, even after treatment. Run-off from farms and wastewater treatment plant overflows contribute high concentrations of pharmaceuticals to the environment. This study assessed the effects of common pharmaceuticals on a cosmopolitan saprophagous insect, Megaselia scalaris (Diptera: Phoridae). Larvae were reared on artificial diets spiked with contaminants of emerging concern (CECs) at environmentally relevant concentrations. Female flies showed no oviposition preference for treated or untreated diets. Larvae exposed to caffeine in diets showed increased mortality, and larvae fed antibiotics and hormones showed signs of slowed development, especially in females. The normal sex ratio observed in M. scalaris from control diets was affected by exposure to caffeine and pharmaceutical mixture treatments. There was an overall effect of treatment on the flies' microbial communities; notably, caffeine fed insects displayed higher microbial variability. Eight bacterial families accounted for approximately 95% of the total microbes in diet and insects. Our results suggest that CECs at environmentally relevant concentrations can affect the biology and microbial communities of an insect of ecological and medical importance.