Food contamination with heavy-metal ions and nitrites poses a serious threat to human health. Consequently, the development of fast and sensitive platforms for detecting these contaminants is urgently needed. In this study, a novel sensing platform was developed by integrating carbon nanotubes generated by the pyrolysis of waste masks (WMCNTs) with ZIF-8 for the simultaneous detection of Cd2+, Pb2+, and nitrite. Specifically, the electronic structure of the WMCNT backbone was modulated by doping with B and N atoms. Nanoporous ZIF-8 was then grown in-situ on its surface to produce composites with enhanced electrical conductivities and large specific surface areas. This modification provided more active sites for the attachment of heavy-metal ions and nitrites. Under optimized conditions, the sensing platform exhibited a wide linear range with the Pb2+, Cd2+, and NO2 − limits of detection of 2.68, 12.12, and 5.94 μM, respectively. Notably, the sensing platform demonstrated excellent anti-interference capabilities and effectively detected nitrites and heavy-metal ions in pickled foods.