Chemical hazardous substances and hazardous pathogenic bacteria pose a serious risk to human health. The development of efficient, safe and simple removal technologies is urgent. In this study, waste biomass derived carbon dots in-situ anchored porous g-C3N4 tubes were prepared by supramolecular self-assembly method. The prepared photocatalyst exhibited enhanced light absorption, large surface area, and abundant reactive sites. Photoelectrochemical analyses confirmed that the introduction of CDs could effectively promote the separation and transfer of photogenerated carriers with enhanced degradation of sunset yellow (95.4 %) and inactivation of Escherichia coli (98.3 %) under visible light. Furthermore, the development of g-C3N4 loaded floatable porous alginate sponges for the simultaneous removal of E. coli and sunset yellow from fruit juices, obtaining efficient purification results and satisfactory overall acceptability. This work provides a feasible pathway for photocatalytic decontamination of contaminated liquid food.