Nanomaterials-based biomimetic catalysts with multiple functions are necessary to address challenges in artificial enzymes mimicking physiological processes. Here we report a metal-free nanozyme of modified graphitic carbon nitride and demonstrate its bifunctional enzyme-mimicking roles. With oxidase mimicking, hydrogen peroxide is generated from the coupled photocatalysis of glucose oxidation and dioxygen reduction under visible-light irradiation with a near 100% apparent quantum efficiency. Then, the in situ generated hydrogen peroxide serves for the subsequent peroxidase-mimicking reaction that oxidises a chromogenic substrate on the same catalysts in dark to complete the bifunctional oxidase-peroxidase for biomimetic detection of glucose. The bifunctional cascade catalysis is successfully demonstrated in microfluidics for the real-time colorimetric detection of glucose with a low detection limit of 0.8 μM within 30 s. The artificial nanozymes with physiological functions provide the feasible strategies for mimicking the natural enzymes and realizing the biomedical diagnostics with a smart and miniature device.