• Studied the photoluminescence properties of single heteroatom doped carbon quantum dots (N-CQDs) and double heteroatom doped carbon quantum dots (N/Ag-CQDs, N/Ce-CQDs). • The transition metal (N/Ag-CQDs) and rare earth element (N/Ce-CQDs) in conjunction with nitrogen shows high passivation, which increases the photoluminescence quantum yields. • The fluorescence quenching (Turn-Off) of N-CQDs, N/Ag-CQDs and N/Ce-CQDs is occurred with the addition of Hg 2+ ion. • On the other hand, captopril showed fluorescence recovery (Turn-On) of N-CQDs, N/Ag-CQDs and N/Ce-CQDs which are quenched by Hg 2+ ion. The fluorescence recovery of CQDs is due to the high affinity of thiol group of captopril towards Hg 2+ ion to form Hg-S bonds. • This is the first time report to comparison of single heteroatom doped (N-CQDs) and double heteroatom doped (N/Ag-CQDs and N/Ce-CQDs) carbon quantum dots based sensor for Hg 2+ and captopril detection with the lowest detection limit. A stable carbon quantum dots doped with nitrogen (N-CQDs), co-doped with silver (N/Ag-CQDs), and co-doped with cerium N/Ce-CQDs were synthesized using hydrothermal method. As-synthesized N/Ag-CQDs and N/Ce-CQDs showed high quantum yield compared to N-CQDs. These carbon quantum dots were used as a probe for the detection of mercury and captopril. The fluorescence quenching (turn-off) of N-CQDs, N/Ag-CQDs and N/Ce-CQDs was occured with the addition of Hg 2+ ion. On the other hand, captopril showed fluorescence recovery (turn-on) of N-CQDs, N/Ag-CQDs and N/Ce-CQDs which are quenched by Hg 2+ ion. The fluorescence recovery of CQDs is due to the high affinity of thiol group of captopril towards Hg 2+ ion to form Hg-S bonds. On the basis of fluorescence quenching (turn-off), Hg 2+ was determined with low limit of detection of 1.43 nM, 0.93 nM and 1.38 nM using N-CQDs, N/Ag-CQDs and N/Ce-CQDs, respectively as fluorescence nanoprobes. The fluorescence Turn-on of the CQDs has been applied for the detection of captopril with low limit of detection of 1.65 µM, 0.46 µM and 1.22 µM using N-CQDs, N/Ag-CQDs, and N/Ce-CQDs respectively. The developed sensing probe showed good sensitivity and high fluorescence efficiencies.