This study assessed the green synthesis of phenolic capping silver nanoparticles (PC-Ag NPs) using the green walnut husk (GWH) extract of Juglans regia (J. Regia) as reducing and stabilizing agents. The synthesized nanoparticles were evaluated in terms of optical and chemical properties. The results of the analysis confirmed that the PC-Ag NPs formed successfully. Next, the prepared nanoparticles were applied as a colorimetric sensor for spectra and naked-eye detection of Cd2+ and Ni2+ ions. Owing to the reaction of functional groups of GWH extract, including hydroxyl and carboxyl on the surface of detector nanoparticles with Cd2+ and Ni2+ ions, aggregation and sedimentation occurred. These reactions suggest the formation of chelate complexes through polyphenol capabilities to chelate metals. Under optimized conditions (pH = 6, reaction time = 75 min), the introduced nanosensor exhibited good selectivity, sensitivity, and linearity (with R2 = 0.9899 and 0.9922 for Cd2+ and Ni2+, respectively). The detection limit of the reported method was 0.2 nM. Further, the synthesized nanosensor was utilized to determine target analytes in environmental samples, whereby satisfactory recoveries were achieved within 90.57 to 113.61%.