Background Some concomitant medications including antibiotics (ATB) have been reproducibly associated with worse survival following immune checkpoint inhibitors (ICIs) in unselected patients with non-small cell lung cancer (NSCLC) (according to programmed death-ligand 1 (PD-L1) expression and treatment line). Whether such relationship is causative or associative is matter of debate. Methods We present the outcomes analysis according to concomitant baseline medications (prior to ICI initiation) with putative immune-modulatory effects in a large cohort of patients with metastatic NSCLC with a PD-L1 expression ≥50%, receiving first-line pembrolizumab monotherapy. We also evaluated a control cohort of patients with metastatic NSCLC treated with first-line chemotherapy. The interaction between key medications and therapeutic modality (pembrolizumab vs chemotherapy) was validated in pooled multivariable analyses. Results 950 and 595 patients were included in the pembrolizumab and chemotherapy cohorts, respectively. Corticosteroid and proton pump inhibitor (PPI) therapy but not ATB therapy was associated with poorer performance status at baseline in both the cohorts. No association with clinical outcomes was found according to baseline statin, aspirin, β-blocker and metformin within the pembrolizumab cohort. On the multivariable analysis, ATB emerged as a strong predictor of worse overall survival (OS) (HR=1.42 (95% CI 1.13 to 1.79); p=0.0024), and progression free survival (PFS) (HR=1.29 (95% CI 1.04 to 1.59); p=0.0192) in the pembrolizumab but not in the chemotherapy cohort. Corticosteroids were associated with shorter PFS (HR=1.69 (95% CI 1.42 to 2.03); p<0.0001), and OS (HR=1.93 (95% CI 1.59 to 2.35); p<0.0001) following pembrolizumab, and shorter PFS (HR=1.30 (95% CI 1.08 to 1.56), p=0.0046) and OS (HR=1.58 (95% CI 1.29 to 1.94), p<0.0001), following chemotherapy. PPIs were associated with worse OS (HR=1.49 (95% CI 1.26 to 1.77); p<0.0001) with pembrolizumab and shorter OS (HR=1.12 (95% CI 1.02 to 1.24), p=0.0139), with chemotherapy. At the pooled analysis, there was a statistically significant interaction with treatment (pembrolizumab vs chemotherapy) for corticosteroids (p=0.0020) and PPIs (p=0.0460) with respect to OS, for corticosteroids (p<0.0001), ATB (p=0.0290), and PPIs (p=0.0487) with respect to PFS, and only corticosteroids (p=0.0033) with respect to objective response rate. Conclusion In this study, we validate the significant negative impact of ATB on pembrolizumab monotherapy but not chemotherapy outcomes in NSCLC, producing further evidence about their underlying immune-modulatory effect. Even though the magnitude of the impact of corticosteroids and PPIs is significantly different across the cohorts, their effects might be driven by adverse disease features.