A cohort study examined the risk of substance use disorders (SUDs) in US veterans with type 2 diabetes after initiation of GLP-1 receptor agonists compared with SGLT-2 inhibitors. The primary trial included 524,817 patients without a history of SUD (124,001 on GLP-1, 400,816 on SGLT-2). GLP-1 initiation was associated with a reduced risk of SUDs related to alcohol (HR 0.82, 98.5% CI 0.78-0.85; NRD -5.57/1000), cannabis (HR 0.86; NRD -2.25), cocaine (HR 0.80; NRD -0.57), nicotine (HR 0.80; NRD -1.64), opioids (HR 0.75; NRD -0.86) and other substances (HR 0.94; NRD -1.12), as well as the composite result of all SUDs (HR 0.86; NRD -6.61). In 81,617 patients with existing SUD (16,768 on GLP-1, 64,849 on SGLT-2), GLP-1 reduced the risk of SUD-related ED visits (HR 0.69; NRD -8.92), hospitalizations (HR 0.74; NRD -3.74), SUD-related mortality (HR 0.50; NRD -1.52), overdose (HR 0.61; HR -1.49) and suicidal attempts (HR 0.83; HR -9.95). Analyzes of treatment adherence confirmed consistent results. The study suggests a preventive effect of GLP-1 on both the onset and exacerbation of SUD.