Selective sensing and removal of toxic heavy metals from water are highly essential since their presence poses significant health and environmental hazards. Herein, we designed and synthesized a novel fluorescent nonconjugated organic polymer by strategically incorporating two key functional groups, namely, a dansyl fluorophore and dithiocarbamate (DTC). Different characterization techniques, including 1 H nuclear magnetic resonance (NMR), scanning electron microscopy (SEM), X-ray diffraction (XRD), energy-dispersive X-ray analysis (EDAX), Fourier transform infrared (FTIR), and fluorescence spectroscopy, were performed to understand its structure and material properties. The quantum yield of 4.72% and its solid-state fluorescence indicate that it has potential for various applications in several technological and scientific domains. In this study, we investigated a specific application involving the detection and elimination of heavy metals from water. Interestingly, the presence of dansyl and DTC moieties demonstrated remarkable selectivity toward Cu 2+ , Co 2+ , Ni 2+ , Fe 3+ , and Fe 2+ sensing, displaying distinct color changes specific to each metal. Cu 2+ resulted in a yellow color, Co 2+ showed a green color, Ni 2+ displayed a pale yellowish-green color, and Fe 2+ /Fe 3+ exhibited a brown color. The LOD (limit of detection) for each metal was obtained in the nanomolar range by using a fluorescence spectrometer and the micromolar range from UV−visible spectra: 13.27 nM and 0.518 μM for Cu 2+ , 8.27 nM and 0.581 μM for Co 2+ , 14.36 nM and 0.140 μM for Ni 2+ , 14.95 nM and 0.174 μM for Fe 2+ , and 15.54 nM and 0.33 μM for Fe 3+ . Moreover, the DTC functionality on its backbone facilitates effective interaction with the aforementioned heavy metals, subsequently removing them from water (except Fe 2+ and Fe 3+ ), validating its dual functionality as both an indicator and a purifier for heavy metals in water. The polymer exhibited a maximum adsorption capacity of 192.30 mg/g for Cu 2+ , 159.74 mg/g for Co 2+ , and 181.81 mg/g for Ni 2+ . Furthermore, this approach exhibits versatility in crafting fluorescent polymers with adjustable attributes that are suitable for a wide range of applications.