The emerging drug diclofenac (DICF) has been found to penetrates aquatic systems at alarming concentrations and poses serious and irreversible ecotoxicological threats around the world. In this work, we present the solid-state mechanochemical synthesis of 3D flower-like bismuth oxyhalides (BiOX, where X = Cl, Br, and I) as electrode materials for electrochemical detection of DICF. The characteristics of the flower-like BiOX are systematically investigated using spectroscopic and microscopic techniques. The BiOI-modified glassy carbon electrode (GCE) exhibits superior electrochemical performance for DICF detection compared to the pristine GCE, BiOCl/GCE, and BiOBr/GCE. The 3D flower-like architecture of BiOI facilitates favorable electrocatalytic activities due to its abundant electroactive sites, good conductivity, large surface area, and fast ion diffusion. Notably, the BiOI/GCE displays wide linear ranges (0.5–11.3 & 11.3−76), a low limit of detection (0.11 μM), high sensitivity (1.33 μA μM–1 cm–2), excellent repeatability (2.91 %), good reproducibility (2.88 %), and anti-interfering ability (<±5 %). To validate the practicality of the fabricated BiOI/GCE, the quantitative detection of DICF in human urine and river water is demonstrated and achieves acceptable recovery values. This study introduces an innovative approach to design and produce electrode materials with distinct properties, enabling enhanced electrocatalysis for various electrochemical sensing applications.