In this work, an easy facile and cost-effective hydrothermal method was used to synthesize the carbon quantum dots (CQD) doped graphitic carbon nitride (g-C3N4) as well as their potential application in sensing Fe3+ ions selectively. The photoluminescence properties of CQD, g-C3N4, and CQD/g-C3N4 have been studied, and a strong blue luminescence with excitation wavelength-independent, pH-sensitive, and ionic strength-dependent luminescence was observed, as confirmed by UV-vis absorption, X-ray powder diffraction, Fourier transform infrared spectroscopy, transmission electron microscope, and Field emission scanning electron microscope. The prepared CQD doped g-C3N4 illustrated a highly sensitive and selective response towards Fe3+ ions in comparison with the prepared CQDs. Less than 335 nm ultraviolet light, the CQD emits blue photoluminescence and also has better water solubility, biocompatibility, and excellent stability, with a significant quantum yield of 36.1%. The improved electronic properties and surface chemical reactivity caused by N atoms in CQD of CQD-g-C3N4 promote coordination between functional groups on the CQD surface and Fe3+ ions, resulting in a significant fluorescence quenching effect of the CQDs in the presence of Fe3+ ions. This "on-off" luminescence CQDs nanoprobe for Fe3+ ions had a linear relationship between ln(F-0/F) and the concentration of Fe3+ ions, and a limit of detection (LOD) was measured to be 2.8 nM with a linear range of 20-100 mu M under ideal conditions. Furthermore, ascorbic acid (AA) was used to reduce Fe3+ to Fe2+ ions, resulting in the recovery of CQD fluorescence. Additionally, the analysis of Fe3+ ions in the drinking water, tap water, and lake water samples showed that the proposed method has the potential to be used in the metal analysis of environmental samples.