Importance: Evidence indicates that preexisting neuropsychiatric conditions confer increased risks of severe outcomes from COVID-19 infection. It is unclear how this increased risk compares with risks associated with other severe acute respiratory infections (SARIs). Objective: To determine whether preexisting diagnosis of and/or treatment for a neuropsychiatric condition is associated with severe outcomes from COVID-19 infection and other SARIs and whether any observed association is similar between the 2 outcomes. Design, Setting, and Participants: Prepandemic (2015-2020) and contemporary (2020-2021) longitudinal cohorts were derived from the QResearch database of English primary care records. Adjusted hazard ratios (HRs) with 99% CIs were estimated in April 2022 using flexible parametric survival models clustered by primary care clinic. This study included a population-based sample, including all adults in the database who had been registered with a primary care clinic for at least 1 year. Analysis of routinely collected primary care electronic medical records was performed. Exposures: Diagnosis of and/or medication for anxiety, mood, or psychotic disorders and diagnosis of dementia, depression, schizophrenia, or bipolar disorder. Main Outcomes and Measures: COVID-19-related mortality, or hospital or intensive care unit admission; SARI-related mortality, or hospital or intensive care unit admission. Results: The prepandemic cohort comprised 11 134 789 adults (223 569 SARI cases [2.0%]) with a median (IQR) age of 42 (29-58) years, of which 5 644 525 (50.7%) were female. The contemporary cohort comprised 8 388 956 adults (58 203 severe COVID-19 cases [0.7%]) with a median (IQR) age of 48 (34-63) years, of which 4 207 192 were male (50.2%). Diagnosis and/or treatment for neuropsychiatric conditions other than dementia was associated with an increased likelihood of a severe outcome from SARI (anxiety diagnosis: HR, 1.16; 99% CI, 1.13-1.18; psychotic disorder diagnosis and treatment: HR, 2.56; 99% CI, 2.40-2.72) and COVID-19 (anxiety diagnosis: HR, 1.16; 99% CI, 1.12-1.20; psychotic disorder treatment: HR, 2.37; 99% CI, 2.20-2.55). The effect estimate for severe outcome with dementia was higher for those with COVID-19 than SARI (HR, 2.85; 99% CI, 2.71-3.00 vs HR, 2.13; 99% CI, 2.07-2.19). Conclusions and Relevance: In this longitudinal cohort study, UK patients with preexisting neuropsychiatric conditions and treatments were associated with similarly increased risks of severe outcome from COVID-19 infection and SARIs, except for dementia.