The global pandemic of COVID-19 is colliding with the epidemic of opioid use disorders (OUD) and other substance use disorders (SUD) in the United States (US). Currently, there is limited data on risks, disparity, and outcomes for COVID-19 in individuals suffering from SUD. This is a retrospective case-control study of electronic health records (EHRs) data of 73,099,850 unique patients, of whom 12,030 had a diagnosis of COVID-19. Patients with a recent diagnosis of SUD (within past year) were at significantly increased risk for COVID-19 (adjusted odds ratio or AOR = 8.699 [8.411-8.997], P < 10-30), an effect that was strongest for individuals with OUD (AOR = 10.244 [9.107-11.524], P < 10-30), followed by individuals with tobacco use disorder (TUD) (AOR = 8.222 ([7.925-8.530], P < 10-30). Compared to patients without SUD, patients with SUD had significantly higher prevalence of chronic kidney, liver, lung diseases, cardiovascular diseases, type 2 diabetes, obesity and cancer. Among patients with recent diagnosis of SUD, African Americans had significantly higher risk of COVID-19 than Caucasians (AOR = 2.173 [2.01-2.349], P < 10-30), with strongest effect for OUD (AOR = 4.162 [3.13-5.533], P < 10-25). COVID-19 patients with SUD had significantly worse outcomes (death: 9.6%, hospitalization: 41.0%) than general COVID-19 patients (death: 6.6%, hospitalization: 30.1%) and African Americans with COVID-19 and SUD had worse outcomes (death: 13.0%, hospitalization: 50.7%) than Caucasians (death: 8.6%, hospitalization: 35.2%). These findings identify individuals with SUD, especially individuals with OUD and African Americans, as having increased risk for COVID-19 and its adverse outcomes, highlighting the need to screen and treat individuals with SUD as part of the strategy to control the pandemic while ensuring no disparities in access to healthcare support.