Semiconductor-mediated photocatalytic technology has emerged as a promising strategy for wastewater remediation. Among various photocatalysts, graphitic carbon nitride motifs─metal-free and two-dimensional triazine-based polymers have attracted significant research interest due to their multifunctional characteristics. In this study, a nitrogen-enriched form of graphitic carbon nitride (g-C3N5), featuring a lower C/N ratio and an additional triazole moiety replacing the conventional triazine unit, was synthesized via thermal polymerization of 3-amino-1H-1,2,4-triazole. Subsequently, its heterostructure was strategically engineered by incorporating highly crystalline silver iodide (AgI) nanoparticles through a facile solid-state approach. Physicochemical characterizations confirmed the crystalline, porous, and visible-light-responsive nature of the fabricated heterostructured semiconducting material (AgI/g-C3N5 or AICN). The enhanced charge separation efficiency of the heterostructure was evidenced by photoluminescence analysis and further supported by electrochemical investigations. Comprehensive photocatalytic degradation experiments using Rhodamine B (RhB), a chromophoric dye, and chloramine T (CT), a drug derivative, revealed that the 20 wt % AgI/g-C3N5 composite (20AICN) exhibited the highest photocatalytic efficiency among the series of fabricated photocatalysts─achieving 96.5% degradation of RhB and 82.8% degradation of CT within 24 and 120 min of visible-light irradiation, respectively. Process optimization using Box-Behnken Design and Response Surface Methodology identified the optimal operational parameters: 10 ppm pollutant concentration, 1 g L- 1 photocatalyst dose, and neutral pH 7, with respective irradiation times of 24 min (RhB) and 120 min (CT). A strong correlation was observed between experimental and predicted outcomes (R2 > 0.991). Kinetic analysis demonstrated that the degradation followed pseudo-first-order kinetics, and mineralization studies revealed over 50% TOC removal of these pollutants. Recyclability tests confirmed the excellent photostability of the 20AICN photocatalyst, showing insignificant photocorrosion after seven consecutive photocatalytic cycles. Scavenging experiments identified superoxide radicals (O2•-) and photogenerated holes (h+) as the dominant reactive species responsible for the degradation. These findings, along with Mott-Schottky analysis, supported a type-II heterojunction photocatalytic mechanism governing the degradation process.