Monitoring the presence of illicit and pharmaceutical drugs in wastewater has emerged as a powerful tool for determining drug consumption patterns and trends within a specific population group. In this study, an analytical method has been developed to determine the presence of forty psychoactive substances, including stimulants, benzodiazepines, antidepressants, and opioids, in wastewater. The proposed approach combines in-situ wastewater single sampling, solid-phase extraction, and ultra-high performance liquid chromatography coupled with tandem mass spectrometry determination. Extraction conditions were evaluated to obtain the best extraction efficiencies and sensitivity. The developed method provided limits of quantification ranging from 1.7 (LSD) to 73.1 (5-EAPB) ng L-1, recoveries from 81 (butylone) to 118 % (diphenhydramine), and relative standard deviations lower than 17 %. More than one hundred wastewater samples were collected at different locations from Campus of Valencia University between 2023 and 2024 for estimating substance consumption by the university community and evaluation of ongoing awareness actions. The results showed the presence of 21 substances in at least one site. Venlafaxine and its main metabolite, escitalopram, and clorazepate were the pharmaceuticals found with the highest occurrence, with concentrations ranging from 15 (clorazepate) to 11,309 ng L-1 (O-desmethylvenlafaxine). Regarding the illicit drugs, cocaine and benzoylecgonine were found in the greatest proportion, with concentrations ranging from 6 to 980 ng L-1 and from 19 to 5699 ng L-1, respectively. From these concentrations the population consumption was calculated, providing the highest mean consumption for venlafaxine and O-desmethylvenlafaxine (489.0 and 37.2 mg day-1 1000 people-1), followed by cocaine, tramadol, MDMA and amphetamine with consumption values of 40.8, 30.9, 30.8 and 17.0 mg day-1 1000 people-1, respectively. The proposed analytical strategy has been demonstrated to be suitable for monitoring the detection frequency of psychoactive substances, providing insight into temporal and spatial trends of drug use through wastewater surveillance.