Diabetes mellitus (DM) and Helicobacter pylori infection (HPI) pose increasing public health challenges in aging societies, sharing common pathophysiological mechanisms, and linked to significant health risks. Our study examines their respective impacts on all-cause and cardiovascular mortalities in a comprehensive longitudinal population-based analysis. The study analyzed data from the National Health and Nutrition Examination Survey (NHANES) database conducted between 1999 and 2019, which included information on Diabetes mellitus status and Helicobacter pylori infection status. Mortality data were obtained from the same database mentioned above. Among the 2719 participants, 1362 (50.1%) were free of both diabetes mellitus (DM) and Helicobacter pylori infection (HP) (DM -/HP -), 140 (5.1%) had DM alone (DM +/HP -), 1011 (37.2%) had HP alone (DM -/HP +), and 206 (7.6%) had both DM and HP (DM +/HP +). Compared to the DM -/HP - group, the DM +/HP - and DM + /HP + groups demonstrated increased all-cause mortality with adjusted hazard ratios (HRs) of 1.40 (95% [CI] 1.07-1.78) and 1.46 (95% CI 1.15-1.84), respectively. For diabetic mortality, DM +/HP- group and DM + /HP + group showed increased HR of 6.30 (95% CI 1.30-30.43) and 8.56 (95% CI 1.98-36.94), respectively. For cardiovascular mortality, the DM + /HP- group and DM + /HP + group exhibited increased HR of 1.75 (95% CI 1.14-2.69) and 1.98 (95% CI 1.40-2.79), respectively. The DM + /HP + cohort displayed the highest risk of overall mortality (p for trend = 0.003), diabetic mortality (p for trend < 0.0001), an6d cardiovascular mortality (p for trend < 0.0001). The concurrent presence of DM and Helicobacter pylori infection significantly amplifies the risk of all-cause, cardiovascular, and diabetic mortality. Individuals with either condition may necessitate heightened management to prevent the onset of the other ailment and reduce mortality rates.