One of the key concerns in public health is food security in the food sector. Due to the large amounts of potentially hazardous metals in wastewater, this practice may pose serious environmental and health risks to neighboring residents. In this study, the health effects of heavy metals in vegetables irrigated with wastewater were studied. The findings indicated a massive accumulation of heavy metals in wastewater-irrigated soil and vegetables collected from Bhakkar, Pakistan. The current study looked at the effects of wastewater irrigation on metal buildup in the soil–plant continuum and the health hazards that come with it (Cd, Co, Ni, Mn, Pb, and Fe). Heavy metal concentrations in vegetables cultivated on soil irrigated with untreated wastewater were not significantly lower (p≥ 0.05) than in vegetables grown on wastewater-irrigated soil and were below the World Health Organization’s recommended limits. A considerable amount of the selected hazardous metals was also swallowed by adults and children who consumed these vegetables, according to the research. On soil that had received wastewater irrigation, Ni and Mn were substantially different atp≥ 0.001 levels. Pb, Ni, and Cd had health risk scores higher than the ones in all ingested vegetables, while Mn had a health risk score greater than the ones in turnips, carrots, and lettuce. The results also showed that both adults and children who consumed these vegetables absorbed a significant amount of the chosen toxic metals. Pb and Cd were shown to be the most dangerous chemical compounds to human health, and everyday consumption of agricultural plants irrigated with wastewater may pose a health risk, according to the health risk criteria.