Sleep is one of the most important activities for health and the processes related to the central nervous system. Healthcare workers commonly present alterations in the sleep-wake cycle due to complex work schedules because 24-hour attention to the population is required in public health institutions. The increase in care needs caused by the COVID-19 pandemic causedchanges in work schedules; as in Mexico, the number of patients requiring consultation in all public health units increased. Chronic partial sleep deprivation (< 7 hours of sleep in the 24-hour cycle) is the most frequent sleep alteration in Mexican health workers. However, it has not been explored whether work modifications due to the pandemic had an impact on the sleep quality of workers. We aimed to describe the prevalence of poor sleep quality and the associated factors in workers (clinical and non-clinical) of a primary care medical unit. We conducted an analytical and cross-sectional studyduring November and December 2022.We used the following tools for studying clinical and non-clinical staff working at a family medicine primary care unit: Pittsburgh Sleep Quality Index, Hamilton Anxiety Scale, Beck Depression Inventory, Maslach Burnout Inventory, and Graffar-Méndez-Castellanos socioeconomic level scale, as well as a data collection sheet and a survey of workers' knowledge, attitudes, fears, and needs regarding COVID-19. A total of 233 workers were surveyed. The prevalence of poor sleep quality was 56.7%. A higher score on the Beck Depression Inventory (OR: 1.21, CI 95%: 1.13-1.29), being a doctor (OR: 3.48, CI 95%: 1.5-8.01), and frequent alcohol consumption (OR: 2.4, CI 95%: 1.13-5.2) were identified as risk factors for poor sleep quality. A lower score in the depersonalization dimension of the Maslach Burnout Inventory (OR: 0.5, CI 95%: 0.26-0.99) was identified as a protective factor for poor sleep quality. During the pandemic, the stress of health workers increaseddue to work alterations that were necessary to treat the greatest number of patients, so theirquality of sleep decreased. Unfortunately, the mental health of healthcare workers is often under-assessed in many institutions. Thus, it is relevant to identify risk factors for alterations (especially those of sleep), since by identifying the target population, comprehensive interventions can be carried out, which can reduce the prevalence of burnout, anxiety, and depression, but if not addressed, the alterations can lead to inadequate care for users of health units.