In conclusion, our findings demonstrate that elevated IL-6 not only correlates with the incidence of irAEs but also serves as a prognostic indicator for poorer outcomes in gastric adenocarcinoma and esophageal squamous cell carcinoma patients receiving ICIs. This evidence concerns the gene IL6 and esophageal squamous cell carcinoma.