Extreme heat events in cities necessitate closer examination of urban vegetation’ capacity to mitigate extreme hot weather. However, the cooling capacity of vegetation (CCV) and its driving forces of 2D and 3D landscape metrics under extreme hot weather conditions in dry-hot and humid-hot cities, particularly within different functional zones is still not well understood. The results indicate that the CCV is more pronounced in humid-hot cities than in dry-hot cities, particularly during periods of extreme hot weather. This CCV varied significantly across different functional zones, being the lowest in commercial zones and the highest in green space zones. Moreover, residential zones in humid-hot cities have higher CCV when the weather is more extreme. In dry-hot and humid-hot cities, urban vegetation landscape configuration metrics (such as patch and edge densities) contribute significantly to the CCV, and landscape composition (vegetation coverage) also contributes, with a significant increase during periods of extreme hot weather, particularly in humid-hot cities. Additionally, the 3D building morphology plays a crucial role in moderating the CCV; however, its impact diminishes during extreme heat. We also found that the CCV does not increase further after vegetation coverage is greater than 30–40 % in dry-hot cities, compared to approximately 60–80 % in humid-hot cities. The CCV increased nonlinearly with increasing urban vegetation largest patch index and decreasing urban vegetation patch density in dry-hot and humid-hot cities, with different thresholds of vegetation coverage and largest patch index under normal and extreme hot weather. A higher building height increased the CCV in humid-hot cities and reduced the CCV in dry-hot cities, particularly under extreme hot weather, and sparse high-rise buildings were better suited to humid-hot cities for increasing urban CCV. These findings provide valuable insights for urban planners to enhance the urban CCV, contributing to long-term urban resilience and public health protection during extreme heat events.