BackgroundAlthough trade union membership rates have continuously decreased over the past 30 years, about 50% of UK employees are still represented by a union. Yet, studies on the association between collective bargaining and workers' mental health are sparse, especially in the pandemic context. This study examines differences on UK workers' mental health due to trade union presence and membership between pre-pandemic and pandemic periods. MethodsIn this longitudinal study, we analysed Understanding Society panel data in which the same participants are followed over time. The data concerned individuals aged 16 years and older and were collected biannually before COVID-19 pandemic (Waves 8–10: 2017–2020) and on a more frequent basis during pandemic (all COVID-19 surveys from 2020 [April, May, June, July, September, November] to 2021 [January, March, September] periods). The primary outcome was General Health Questionnaire-12 (GHQ-12) caseness (GHQ-12 score ≥4: probability of caseness). Two exposures were used separately: trade union presence and trade union membership, interacting with a binary variable splitting time periods between before and during the pandemic. Our analytical sample included 49 915 observations from 5988 individuals. 3341 (56%) individuals worked in unionised workplaces. We fitted mixed–effects logistic regression models adjusting for age, gender, ethnicity, UK residence, educational level, financial situation, workplace size, and survey interview date. We then replicated the analyses including a 3-way interaction with industry. All Understanding Society participants gave written informed consent. Ethics approval was not required. FindingsIn our sample, approximately 41% were male and 59% were female, and the mean age was 47·2 years (SD 11·4). Comparing pre-pandemic and pandemic periods, we found that the odds of GHQ-12 caseness for those in non-unionised workplaces increased by 45% (odds ratio 1·45, 95% CI 1·17–1·80), whereas in unionised workplaces odds increased by 28% (1·28, 1·05–1·57). When analysis was confined to unionised workplaces, the odds of GHQ-12 caseness for non-union members increased more (1·40, 1·07–1·83) compared with members (1·18, 0·91–1·53); however, with wide CIs. Overall, industry had no modification effect in both exposures. Sensitivity analysis using GHQ-36 as a continuous outcome demonstrated no real change in the patterns of the results. InterpretationThe mental health of workers in unionised workplaces appears to have worsened less than the mental health of those in non-unionised workplaces; however, there is insufficient evidence of effect differential by type of industrial sector. Designing policies that encourage and facilitate trade union presence in workplaces should be promoted, as they are likely to mitigate adverse mental health effects in times of extreme uncertainty. FundingMedical Research Council, Chief Scientist Office, Belgian National Scientific Fund.