There is growing attention focused toward the problems of ecological sustainability and food safety raised from the abuse of herbicides, which underscores the need for the development of a portable and reliable sensor for simple, rapid, and user-friendly on-site analysis of herbicide residues. Herein, a novel multifunctional hydrogel composite is explored to serve as a portable and flexible sensor for the facile and efficient analysis of atrazine (ATZ) residues. The hydrogel electrode is fabricated by doping graphite-phase carbon nitride (g-C3N4) into the aramid nanofiber reinforced poly(vinyl alcohol) hydrogel via a simple solution-casting procedure. Benefiting from the excellent electroactivity and large specific surface area of the solid nanoscale component, the prepared hydrogel sensor is capable of simple, rapid, and sensitive detection of ATZ with a detection limit down to 0.002 ng/mL and per test time less than 1 min. After combination with a smartphone-controlled portable electrochemical analyzer, the flexible sensor exhibited satisfactory analytical performance for the ATZ assay. We further demonstrated the applications of the sensor in the evaluation of the ATZ residues in real water and soil samples as well as the user-friendly on-site point-of-need detection of ATZ residues on various agricultural products. We envision that this flexible and portable sensor will open a new avenue on the development of next-generation analytical tools for herbicide monitoring in the environment and agricultural products.