With the objective of understanding how the mixed convective and the geometrical parameters together influence the nanofluid behavior (enhancement or deterioration) and finding the best configuration of the moving walls for engineering purposes, this paper investigates the single lid-driven mixed convective flow of carbon nanotubes/kerosene nanofluids confined in vertical and horizontal cavities with non-uniform boundary conditions applied to the vertical walls. The findings of this paper can provide crucial conclusions into the behavior and optimization of nanofluids in mixed convective flows in enclosed systems for engineering applications. The system of the governing equations is tackled by a validated in-house code, where we compared the code accuracy with previous experimental and numerical works. The governing parameters are -50 ≤ Pe ≤ 50, 0.5 ≤ A ≤ 4, and 0 ≤ φ ≤ 3%. The effective nanofluid properties are calculated using special experimental models. The outcomes revealed that the carbon nanotube effect on heat transfer depends on the aspect ratio. The greater the aspect ratio, the more pronounced the negative impact of the nanotube concentration where Nusselt number is reduced by 4.49% and 16.17% for φ = 0.01 and 0.03, respectively, in the case of Pe = 0 and A = 4. The Peclet number also has a significant impact on the heat transfer, especially for higher aspect ratios, and diminishes the critical aspect ratio where the nanofluid's behavior changes. An augmentation in the aspect ratio and Peclet number brings about an augmentation in the Nusselt number. Additionally, the Peclet number can reverse the conjugated effect of carbon nanotube volume fraction and aspect ratio on nanofluid enhancement. When Pe = 50 in C1, heat transfer rate is 1.75% and 1.11% enhanced for φ = 0.01 and 0.03, respectively, and A = 4. Moving horizontal walls exhibits higher heat transfer enhancement compared to vertical ones.