Immunotherapy is an effective treatment for many cancer types. However, YTHDF2 effects on the prognosis of different tumors and correlation with tumor immune infiltration are unclear. Here, we analyzed The Cancer Genome Atlas and Gene Expression Omnibus data obtained through various web-based platforms. The analyses showed that YTHDF2 expression and associated prognoses may depend on cancer type. High YTHDF2 expression was associated with poor overall survival in lower-grade glioma (LGG). In addition, YTHDF2 expression positively correlated with expression of several immune cell markers, including PD-1, TIM-3, and CTLA-4, as well as tumor-associated macrophage gene markers, and isocitrate dehydrogenase 1 in LGG. These findings suggest that YTHDF2 is a potential prognostic biomarker that correlates with LGG tumor-infiltrating immune cells.