In this secondary analysis of multicenter retrospective real‐world data, we examined whether an existing anxiety or depression diagnosis was associated with the safety and efficacy of anti‐PD‐1 or anti‐PD‐L1 monotherapy across cancer types. Here, CD274 is linked to cancer.