In this study, the polyvinylidene fluoride (PVDF) membrane combined with carboxymethyl cellulose (CMC) as a complexing agent was investigated for the rejection of Pb(II), Zn(II), and Fe(III) heavy metals from water and wastewater. FTIR, XRD, SEM, and EDX characterized the fabricated PVDF membrane to ascertain the physicochemical properties and governing filtration mechanism. The PVDF ultrafiltration system integrated with CMC was modeled, evaluated, and optimized using response surface methodology (RSM). The Box-Behnken design (BBD) was applied to determine the influence of three independent experimental parameters, i.e., pH, metal ions concentration, and CMC dosage. The proposed RSM model better described the experimental results with high R2 values (0.97-0.99) for all three metal ions. The optimized process parameters obtained by RSM showed that the maximum rejection % of Pb(II) (100), Zn(II) (89.74), and Fe(III) (99.05) was achieved at solution pH of 7.64, 6.72, and 4.23, with initial metal concentrations 27.62, 20.46, and 133.15 mg/L, and CMC dosage 1.99, 0.14, and 0.46 g/L, respectively. The FTIR and SEM analysis confirmed chemical interaction and metal precipitation on the PVDF membrane after filtration, associated with CMC complexation with heavy metals which enhanced % rejection. The PVDF-CMC ultrafiltration system demonstrated good reusability with a reduction of only 5, 40, and 31% rejection for Pb(II), Zn(II), and Fe(III), respectively, after three consecutive cycles. The optimized PVDF-CMC UF system showed excellent recovery of 46.51%, 51.56%, 54.50%, and 72.17% of Pb(II), Fe(III), Cu(II), and Zn(II) ions, respectively, from the real sludge sample. The results indicated that integrating optimized CMC complexation with a PVDF ultrafiltration system is a promising approach for enhanced rejection and recovery of heavy metals from water and real wastewater.