Metformin, an anti-hypoglycemic medication, has been used for decades due to its efficiency and is the most consumed pharmaceutical drug worldwide. Consequently, monitoring its concentration in environmental water is important due to its suspected effect on human health and aquatic life. This study reported the extraction, preconcentration, separation and determination of metformin (MET) in waters. Dispersive solid phase extraction (dSPE) using UiO-66@Fe3O4 nanocomposite as a sorbent was used to extract and preconcentrate MET. The high-performance liquid chromatography-diode array detector (HPLC-DAD) achieved the separation and quantification of MET in the samples. Experiemental design was used to optimise influential variables in the extraction and preconcentration of MET. The linearity, limit of detection (LOD) and limit of quantification (LOQ) for MET were 0.5-100 µg/L (R2 = 0.9987), 0.16 µg/L and 0.53 µg/L, respectively. The intraday (n = 10 same-day replicates) and interday (n = 5 consecutive days) precisions reported as relative standard deviations (RSD %) were less than 5%. The accuracy of the method expressed as percentage recovery (%R) ranged from 84 to 112%. The method was applied to extract and preconcentrate MET in wastewater and river water samples. The MET was detected in greater concentrations in wastewater than in river water samples. The validation based on specificity, trueness, linearity, precision, and application to the analysis of MET in real samples showed that the combination of dSPE and HPLC-DAD methods is applicable for MET monitoring in surface water and wastewater. Furthermore, the dSPE/HPLC-DAD method was rapid, simple and suitable for estimating the concentrations of MET in South African surface water and wastewater for the first time. Lastly, the environmental risk caused by the occurrence of MET in surface water was investigated in terms of hazard quotient (HQ). The HQ values were less than unity, suggesting a low possibility risk for the aquatic organisms.