Background: Heart failure (HF) is not only a common complication in patients with end-stage renal disease (ESRD) but also a major cause of death. Although clinical studies have shown that there is a close relationship between them, the mechanism of its occurrence is unclear. The aim of this study is to explore the molecular mechanisms between HF and ESRD through comprehensive bioinformatics analysis, providing a new perspective on the crosstalk between these two diseases.Methods: The HF and ESRD datasets were downloaded from the Gene Expression Omnibus (GEO) database; we identified and analyzed common differentially expressed genes (DEGs). First, Gene Ontology (GO), Kyoto Encyclopedia of Genes and Genomes (KEGG), and gene set variation analyses (GSVA) were applied to explore the potential biological functions and construct protein−protein interaction (PPI) networks. Also, four algorithms, namely, random forest (RF), Boruta algorithm, logical regression of the selection operator (LASSO), and support vector machine-recursive feature elimination (SVM-RFE), were used to identify the candidate genes. Subsequently, the diagnostic efficacy of hub genes for HF and ESRD was evaluated using eXtreme Gradient Boosting (XGBoost) algorithm. CIBERSORT was used to analyze the infiltration of immune cells. Thereafter, we predicted target microRNAs (miRNAs) using databases (miRTarBase, TarBase, and ENOCRI), and transcription factors (TFs) were identified using the ChEA3 database. Cytoscape software was applied to construct mRNA−miRNA−TF regulatory networks. Finally, the Drug Signatures Database (DSigDB) was used to identify potential drug candidates.Results: A total of 68 common DEGs were identified. The enrichment analysis results suggest that immune response and inflammatory factors may be common features of the pathophysiology of HF and ESRD. A total of four hub genes (BCL6, CCL5, CNN1, and PCNT) were validated using RF, LASSO, Boruta, and SVM-RFE algorithms. Their AUC values were all greater than 0.8. Immune infiltration analysis showed that immune cells such as macrophages, neutrophils, and NK cells were altered in HF myocardial tissue, while neutrophils were significantly correlated with all four hub genes. Finally, 11 target miRNAs and 10 TFs were obtained, and miRNA−mRNA−TF regulatory network construction was performed. In addition, 10 gene-targeted drugs were discovered.Conclusion: Our study revealed important crosstalk between HF and ESRD. These common pathways and pivotal genes may provide new ideas for further clinical treatment and experimental studies.