Repurposing expired drugs is highly significant as it prevents the accumulation of pharmaceutical wastes, optimizes resource usage, and reduces environmental harm. Metformin, used for type II diabetes, lowers blood sugar via decreasing liver glucose production and increasing muscle insulin sensitivity. However, the growing number of expired tablets annually necessitates a strategic approach for repurposing or reusing these tablets. Herein, we develop a simple hydrothermal approach for converting expired metformin to valuable fluorescent carbon quantum dots (m-CQDs) with sizes smaller than 10 nm. The m-CQDs displayed a blue emission at 420 nm when excited at 350 nm. Interestingly, when tetracycline (TC) was added, the blue emission diminished, and a greenish-yellow emission emerged at 530 nm. This emission tunning was the resulting of combination of inner filter effect and aggregation induced emission. Leveraging this dynamic emission tunning, we developed both ratiometric-based fluorescence and color tonality-based visual detection methods for detecting TC in pharmaceuticals and wastewater. More importantly, three assessment tools, ComplexMoGAPI, AGREE, and BAGI were used to evaluate the environmental sustainability of the proposed analytical method. The evaluation confirmed the sustainability of the method and the alignment with the greenness guidelines for analytical methods.