This research reports that the novel NH2-MIL-125(Ti)/cobalt ferrite nanorods composite photocatalyst based on metal-organic framework (MOF) has been synthesized by the microwave heating method. Herein, the sequential electrocoagulation (EC)-photocatalysis combination method was used to remove the chemical oxygen demand (COD), doxorubicin hydrochloride (DOX), and 5-Fluorouracil (5-FU) antineoplastic drugs from wastewater by the composite photocatalyst under a simulated sunlight irradiation. The synthesized photocatalysts were characterized using scanning electron microscopy, energy dispersive X-ray spectroscopy, X-ray diffraction, BraunerEmmet-Teller surface area analyzer, vibrating sample magnetometer, UV-Vis diffuse reflectance spectroscopy, photoluminescence spectroscopy, transient photocurrent response, and electrochemical impedance spectroscopy. In the EC process, three-level, three-factor Box-Behnken design was used to investigate the interaction effects of pH (3-8), time (10-60 min), and current density (100-200 A/m2) on the removal of contaminants. The maximum experimental removal efficiencies of COD, DOX, and 5-FU were 68.2 %, 21.1 %, and 24.5 %, respectively, under EC time of 60 min, pH of 5.98, and current density of 176.77 A/m2. About 99.2 % COD, 93.8 % DOX, and 97.0 % 5-FU were removed from pharmaceutical wastewater using NH2-MIL-125(Ti)/ cobalt ferrite nanorods photocatalyst under cobalt ferrite content of 0.288 g, reaction time of 58.48 min, pH of 7.54, and catalyst dosage of 0.5 g/L. The obtained results demonstrated that the combined process of EC and photocatalysis in the presence of MOFs-based photocatalysts is an effective treat strategy for the pharmaceutical wastewater.