The low-risk group showed better OS, an independent HCC prognostic indicator. A nomogram combining features and TNM stages was constructed. TP53 mutations were more frequent in high-risk individuals. CD4+ T cells, NK cells, and macrophages differed significantly between groups. High-risk individuals had increased immune checkpoint molecule expression. The low-risk group responded better to sorafenib and cisplatin. Here, TP53 is linked to hepatocellular carcinoma.