Individuals with congenital heart disease (CHD) are at an increased risk for cancer. As cancer survival rates improve, the prevalence of late side effects, such as heart failure (HF), is becoming more evident. This study aims to evaluate the risk of developing HF following a cancer diagnosis in patients with CHD, compared with those without CHD and with CHD patients who do not have cancer. CHD patients (n=69799) and randomly selected non-CHD controls (n=650406), born in Sweden between 1952 and 2017, were identified from the Swedish National Health Registers and Total Population Register (excluding those with syndromes and transplant recipients). CHD patients who developed cancer (n=1309) were propensity score-matched with non-CHD patients who developed cancer (n=9425), resulting in a cohort of 1232 CHD patients with cancer and 2602 non-CHD controls with cancer (after exclusion of individuals with HF prior to cancer diagnosis). In a separate analysis, CHD patients with cancer were propensity score-matched with CHD patients without cancer (n=68490). A total of 1233 CHD patients with cancer and 2257 CHD patients without cancer were included in the study. Among CHD patients with cancer, 73 (5.9%) developed HF during a mean follow-up time of 8.5±8.7. Comparatively, in the propensity-matched control population, 29 (1.1%) non-CHD cancer patients (mean follow-up time of 7.3±7.5) and 101 (4.5%) CHD patients without cancer (mean follow-up time of 9.9±9.2) developed HF. CHD patients exhibited a significantly higher risk of HF post-cancer diagnosis compared with the non-CHD control group [hazard ratio (HR) 4.39, 95% confidence interval (CI) 2.83-6.81], after adjusting for age at cancer diagnosis and comorbidities. In the analysis between CHD patients with cancer and those without cancer, the results indicated a significantly higher risk of developing HF in CHD patients with cancer (HR 1.53, 95% CI 1.13-2.07). CHD patients face a more than four-fold increased risk of developing HF after a cancer diagnosis compared with cancer patients without CHD. Among CHD patients, the risk of HF is only modestly higher for those with cancer than for those without cancer. This suggests that the increased HF risk in CHD patients with cancer, relative to non-CHD cancer patients, may be more attributable to CHD itself than to cancer treatment-related side effects.