To further clarify the function of SLC24A2 in T2D and cancer, we comprehensively analyzed the expression and function of SLC24A2 and its related genes in multiple datasets through bioinformatics methods, constructed an efficient T2D prediction model using lasso algorithm, and then evaluated the correlation with cancer prognosis, which reveal the potential mechanism linking T2D and cancers and provided a new target for the diagnosis and treatment of T2D. Here, SLC24A2 is linked to cancer.