Patients with major mental illness (MMI) and substance use disorders (SUD) face barriers in accessing healthcare. In this population-based retrospective cohort study, we investigated the uptake of COVID-19 vaccination in Ontario, Canada among community-dwelling individuals receiving healthcare for major mental illness (MMI) and/or substance use disorders (SUD), comparing them to matched general population controls. Using linked health administrative data, we identified 337,290 individuals receiving healthcare for MMI and/or SUD as of 14 December 2020, matched by age, sex, and residential geography to controls without such healthcare. Follow-up extended until 31 December 2022 to document vaccination events. Overall, individuals receiving healthcare for MMI and/or SUD (N = 337,290) had a slightly lower uptake of first (cumulative incidence 82.45% vs. 86.44%; hazard ratio [HR] 0.83 [95% CI 0.82-0.83]) and second dose (78.82% vs. 84.93%; HR 0.77 [95% CI 0.77-0.78]) compared to matched controls. Individuals receiving healthcare for MMI only (n = 146,399) had a similar uptake of first (87.96% vs. 87.59%; HR 0.97 [95% CI 0.96-0.98]) and second dose (86.09% vs. 86.05%, HR 0.94 [95% CI 0.93-0.95]). By contrast, individuals receiving healthcare for SUD only (n = 156,785) or MMI and SUD (n = 34,106) had significantly lower uptake of the first (SUD 78.14% vs. 85.74%; HR 0.73 [95% CI 0.72-0.73]; MMI & SUD 78.43% vs. 84.74%; HR 0.76 [95% CI 0.75-0.77]) and second doses (SUD 73.12% vs. 84.17%; HR 0.66 [95% CI 0.65-0.66]; MMI & SUD 73.48% vs. 82.93%; HR 0.68 [95% CI 0.67-0.69]). These findings suggest that effective strategies to increase vaccination uptake for future COVID-19 and other emerging infectious diseases among community-dwelling people with SUD are needed.