To our knowledge, this is the first real-world cohort study with the largest sample size to evaluate the efficacy and safety of anti-PD-(L)1 treatment in patients with coexisting malignancy and tuberculosis, as well as the efficacy of anti-tuberculosis treatment in those with active tuberculosis. This evidence concerns the gene CD274 and tuberculosis.