Herein, we report an electrochemical sensor for the detection of ractopamine (RA) and hydrogen peroxide (H 2 O 2 ), based on a silver (Ag)-functionalized Fe 2 O 3 -modified glassy carbon electrode (AFO-GCE). This environment friendly nanosensor is synthesized by a simple and cost-effective ultrasonic technique and characterized by FT-IR, P-XRD, XPS, EIS, HR-SEM and HR-TEM. The obtained results suggest that the average size of the nanoparticles is between 14 and 22 nm. EIS is also performed to prove the fabricated electrode has faster electron transfer and permits a diffusion-controlled process. The fabricated sensor exhibits superior electrocatalytic activity in RA detection with good linearity of 1.0 nM−5.847 μM, sensitivity of 2.28 μA mM −1 cm −2 , limit of detection (LOD) of 1.35 nM and H 2 O 2 detection with high linearity from 10 μM to 6.85 mM, sensitivity of 27.2 μA mM −1 cm −2 , and LOD of 1.98 μM with respectable selectivity, excellent reproducibility, and long-term stability. Further, the sensor is effectively employed for the detection of RA in chicken and pork samples and detection of H 2 O 2 in milk samples with an extensive recovery range of 95−98%.