We identified TGFB1 as a common hub gene between T2DM and PC/LC, significantly affecting survival in cancer patients. Here, TGFB1 is linked to type 2 diabetes mellitus.