Carbon-based functional nanocomposites have emerged as potent antimicrobial agents and can be exploited as a viable option to overcome antibiotic resistance of bacterial strains. In the present study, graphitic carbon nitride nanosheets are prepared by controlled calcination of urea. Spectroscopic measurements show that the nanosheets consist of abundant carbonyl groups and exhibit apparent photocatalytic activity under UV photoirradiation towards the selective production of singlet oxygen. Therefore, the nanosheets can effectively damage the bacterial cell membranes and inhibit the growth of bacterial cells, such as Gram-negative Escherichia coli, as confirmed in photodynamic, fluorescence microscopy, and scanning electron microscopy measurements. The results from this research highlight the unique potential of carbon nitride derivatives as potent antimicrobial agents.