The contamination of aquatic ecosystems with pharmaceuticals, such as carbamazepine (CBZ) and sulfamethoxazole (SMX), poses a risk to both humans and environmental biodiversity. In this regard, research aimed at the detection of pharmaceuticals in the environment remains a priority. The low levels at which these contaminants occur together with the complexity of the samples usually imply the need of sample clean-up and preconcentration strategies prior to quantification. Solid phase extraction (SPE) is frequently used due to the possibility of automatization and the vast diversity of sorbents available. However, its use in large environmental screenings significantly increases the cost of the analytical process, generally associated to the sorbents. In this work, two biomass-based sorbents, derived from waste materials (spent brewery grains and primary paper mill sludge), were used in SPE cartridges for the preconcentration of CBZ and SMX, which were then quantified using high-performance liquid chromatography (HPLC) with UV or fluorescence detection. The SPE procedure was optimized considering the type and mass of sorbent for each pharmaceutical, as well as the type and volume of eluent used, contact time during elution and sample volume. After the optimization procedure, limits of detection reached 0.69 μg/L for CBZ, compared with 164 μg/L without the extraction procedure, and 0.015 μg/L for SMX, compared with the 3 μg/L without the extraction procedure. Recovery results demonstrated that the developed method was accurate, reproductible, and suitable to be used for the determination of SMX and CBZ in surface waters, however it should be improved for their determination in effluent water.