Fine particulate matter, known as PM2.5, is recognized as a risk factor for dementia. However, the specific linkage between PM2.5 constituents and dementia is not well understood. We conducted a cohort of 217,336 participants of the UK Biobank to explore the association of long-term exposure to PM2.5 constituents with all-cause dementia, Alzheimer's disease (AD), and vascular dementia. We estimated PM2.5 constituents based on residential addresses by an evaluation model and used time-varying Cox models and Quantile g-computation models to assess the effects of individual constituents and their mixtures. Genetic susceptibility to dementia was assessed using a polygenic risk score, and its multiplicative and additive interactions with PM2.5 constituents were analyzed. Our results showed that black carbon (BC), ammonium (NH4+), organic matter (OM), and sulfate (SO42-) were positively associated with all-cause dementia, while BC and OM were linked to AD, with BC being the most influential. The combined effect of PM2.5 constituents and genetic risk was stronger than their individual effect. This study offers new insights into the association between PM2.5 constituents and dementia, especially those from fuel combustion and automobile exhaust, and highlights the need for effective prevention strategies.