The different coronavirus disease 2019 (COVID-19) outbreak patterns may have different impact on the mental health, but there is no such report at present. This study was aimed to investigate general populations mental health and sleep quality during the sporadic and outbreak of COVID-19 in Tianjin of China. Two cross-sectional studies included 1090 participants during the COVID-19 sporadic period from 28th January to 28th February 2022 and 2036 participants during the COVID-19 outbreak period from 1st January to 1st February 2023. We used the propensity score matching method to match the 2 samples (sporadic and outbreak group) with a ratio of 1:1. Finally, 1087 participants were included in each group. The demographics, Patient Health Questionnaire-9, Generalized Anxiety Disorder Scale-7, Connor–Davidson Resilience Scale, and Pittsburgh Sleep Quality Index were collected from all participants. There was a significant difference between the sporadic and outbreak groups for COVID-19-infected status, anxiety levels, sleep quality, and phycological resilience (all P < .05). Logistic regression analysis showed that female (P < .05) and depression status (P < .05) were the risk factors for the incidence rate of anxiety and poor sleep quality in sporadic group, and outbreak group, while phycological resilience were robust related to the sleep quality (P < .01). Poor sleep quality (P < .01) was related to the incidence of anxiety in sporadic group but not the outbreak group; anxiety levels (P < .01) were related to sleep quality in sporadic group but not the outbreak group. During the COVID-19 pandemic, general populations experienced high anxiety and poor sleep quality incidence rates, especially in the outbreak period. Different risk models for anxiety and sleep quality were found in the different outbreak patterns.