Evidence suggests reduced survival rates following Severe Acute Respiratory Syndrome Coronavirus 2 (SARS-CoV-2) infection in people with preexisting mental disorders, especially psychotic disorders, before the broad introduction of vaccines. It remains unknown whether this elevated mortality risk persisted at later phases of the pandemic and when accounting for the confounding effect of vaccination uptake and clinically recorded physical comorbidities. We used data from Czech national health registers to identify first-ever serologically confirmed SARS-CoV-2 infections in 5 epochs related to different phases of the pandemic: 1st March 2020 to 30th September 2020, 1st October 2020 to 26th December 2020, 27th December 2020 to 31st March 2021, 1st April 2021 to 31st October 2021, and 1st November 2021 to 29th February 2022. In these people, we ascertained cases of mental disorders using 2 approaches: (1) per the International Classification of Diseases 10th Revision (ICD-10) diagnostic codes for substance use, psychotic, affective, and anxiety disorders; and (2) per ICD-10 diagnostic codes for the above mental disorders coupled with a prescription for anxiolytics/hypnotics/sedatives, antidepressants, antipsychotics, or stimulants per the Anatomical Therapeutic Chemical (ATC) classification codes. We matched individuals with preexisting mental disorders with counterparts who had no recorded mental disorders on age, sex, month and year of infection, vaccination status, and the Charlson Comorbidity Index (CCI). We assessed deaths with Coronavirus Disease 2019 (COVID-19) and from all-causes in the time period of 28 and 60 days following the infection using stratified Cox proportional hazards models, adjusting for matching variables and additional confounders. The number of individuals in matched-cohorts ranged from 1,328 in epoch 1 to 854,079 in epoch 5. The proportion of females ranged from 34.98% in people diagnosed with substance use disorders in epoch 3 to 71.16% in individuals diagnosed and treated with anxiety disorders in epoch 5. The mean age ranged from 40.97 years (standard deviation [SD] = 15.69 years) in individuals diagnosed with substance use disorders in epoch 5 to 56.04 years (SD = 18.37 years) in people diagnosed with psychotic disorders in epoch 2. People diagnosed with or diagnosed and treated for psychotic disorders had a consistently elevated risk of dying with COVID-19 in epochs 2, 3, 4, and 5, with adjusted hazard ratios (aHRs) ranging from 1.46 [95% confidence intervals (CIs), 1.18, 1.79] to 1.93 [95% CIs, 1.12, 3.32]. This patient group demonstrated also a consistently elevated risk of all-cause mortality in epochs 2, 3, 4, and 5 (aHR from 1.43 [95% CIs, 1.23, 1.66] to 1.99 [95% CIs, 1.25, 3.16]). The models could not be reliably fit for psychotic disorders in epoch 1. People diagnosed with substance use disorders had an increased risk of all-cause mortality 28 days postinfection in epoch 3, 4, and 5 (aHR from 1.30 [95% CIs, 1.14, 1.47] to 1.59 [95% CIs, 1.19, 2.12]) and 60 days postinfection in epoch 2, 3, 4, and 5 (aHR from 1.22 [95% CIs, 1.08, 1.38] to 1.52 [95% CIs, 1.16, 1.98]). Cases ascertained based on diagnosis of substance use disorders and treatment had increased risk of all-cause mortality in epoch 2, 3, 4, and 5 (aHR from 1.22 [95% CIs, 1.03, 1.43] to 1.91 [95% CIs, 1.25, 2.91]). The models could not be reliably fit for substance use disorders in epoch 1. In contrast to these, people diagnosed with anxiety disorders had a decreased risk of death with COVID-19 in epoch 2, 3, and 5 (aHR from 0.78 [95% CIs, 0.69, 0.88] to 0.89 [95% CIs, 0.81, 0.98]) and all-cause mortality in epoch 2, 3, 4, and 5 (aHR from 0.83 [95% CIs, 0.77, 0.90] to 0.88 [95% CIs, 0.83, 0.93]). People diagnosed and treated for affective disorders had a decreased risk of both death with COVID-19 and from all-causes in epoch 3 (aHR from 0.87 [95% CIs, 0.79, 0.96] to 0.90 [95% CIs, 0.83, 0.99]), but demonstrated broadly null effects in other epochs. Given the unavailability of data on a number of potentially influential confounders, particularly body mass index, tobacco smoking status, and socioeconomic status, part of the detected associations might be due to residual confounding. People with preexisting psychotic, and, less robustly, substance use disorders demonstrated a persistently elevated risk of death following SARS-CoV-2 infection throughout the pandemic. While it cannot be ruled out that part of the detected associations is due to residual confounding, this excess mortality cannot be fully explained by lower vaccination uptake and more clinically recorded physical comorbidities in these patient groups.