The determination of illegal drugs and psychoactive substances in wastewater is increasingly being used to monitor the use of both by populations in specific areas. This article describes a method for the simultaneous determination of 78 illegal drugs and psychoactive substances in wastewater using direct-injection ultra-high-performance liquid chromatography–tandem mass spectrometry (UHPLC-MS/MS). This method includes the analysis of stimulants, opioids, antidepressants, antipsychotic drugs, anti-anxiety drugs, and hallucinogens. The method was validated in terms of the selectivity, calibration range, recovery, matrix effects, accuracy, precision, limit of detection (LOD), and limit of quantification (LOQ). The correlation coefficients were higher than 0.99 for all analytes, and the calibration range was from 0.2 to 500 ng/L. The LOD and LOQ of this method were 0.1–1 ng/L and 0.2–5 ng/L, respectively. The intra- and inter-day precisions were <9.3% and 11.4%, respectively, and the recovery ranged from 81.3% to 117.7%. The method was applied to real domestic wastewater collected from wastewater treatment plants, and the results showed that morphine, codeine, and ephedrine were detected in all samples. Some samples also contained other illegal drugs and psychoactive substances (such as etomidate, methamphetamine, ketamine, and tramadol). This indicates that the direct-injection UHPLC-MS/MS method can be used for the rapid determination of illegal drugs and psychoactive substances in wastewater.