The performance of photoelectrochemical (PEC) analysis system relies closely on the properties of the photoelectric electrodes. It is of great significance to integrate photoactive materials with flexible substrates to construct ultra-sensitive PEC sensors for practical application. This work reports a novel photoelectrode developed by immobilizing α-Fe2O3 nanoparticles (NPs)/defect-rich carbon nitride (d-C3N4), an excellent Z-scheme heterojunction photoelectric material, onto three-dimensional (3D) flexible carbon fiber textile. Specifically, 3D hierarchical structure of flexible carbon fiber textile provides larger specific surface area and higher mechanical strength than traditional electrodes, resulting in more reaction sites and faster reaction kinetics to achieve signal amplification. Simultaneously, α-Fe2O3/d-C3N4 Z-scheme heterojunction exhibits enhanced light absorption capability and high redox ability, thus dramatically improving the PEC performance. This photoelectrode was used to construct a flexible PEC aptasensor for ultrasensitive detection of penbritin, demonstrating excellent performance in terms of wide linear range (0.5 pM–50 nM), low detection limit (0.0125 pM) and high stability. The design principle is applicable to the manufacture of other photoelectric sensing systems, which provides an avenue for the development of portable environmental analysis and field diagnostics equipment.