Herein, facile room-temperature self-assembly and high-temperature pyrolysis strategy was successively conducted for in situ synthesizing novel TiO2/TiN@N-C heterostructure by using typical sandwich-like precursors (MXene/ZIF-8). Zero-dimensional (0D) TiO2, TiN and N-doped carbon nanoparticles were in situ formed and randomly anchored on the two-dimensional (2D) N-doped carbon substrate surface, making TiO2/TiN@N-C exhibit unique 0D/2D heterostructure. Relative to the extensively studied ZIF-8-derived N-doped carbon nanoparticles, TiO2/TiN@N-C heterostructure displayed greatly boosted electrochemical active specific surface. Benefiting from the enhanced electrochemical property of TiO2/TiN@N-C heterostructure, remarkable signal enhancement effect was achieved in terms of the oxidation of multiple hazardous substances, including clozapine, sunset yellow and benomyl. As a result, a novel electrochemical platform was constructed, the linear detection range were 10–1000 nM, 2.5–1250 nM, 10–1000 nM while the detection limits were evaluated to be 3.5 nM, 1.2 nM, 4.5 nM for clozapine, sunset yellow and benomyl, respectively. Besides, the practicability of the newly developed electrochemical method was verified by assessing the content of clozapine, sunset yellow and benomyl in real food samples.