Wetlands, as vital components of urban ecological infrastructure, provide essential ecosystem services. However, they face increasing risks of degradation and loss due to their vulnerability, environmental changes, and human activities. Therefore, effective restoration efforts are urgently needed. This study adopts a novel approach by considering the urban–rural gradient and integrates land use data, ecological parameters, and anthropogenic factors in Hefei City. Through morphological spatial pattern analysis, principal component analysis, and affinity propagation, this study identifies and analyzes urban–rural gradients. Using the optimal parameter geographic detector, the drivers of wetland changes from 1990 to 2020 are quantitatively assessed across different urban–rural gradients in Hefei. The findings indicate the following. (1) A persistent reduction in wetland expanse throughout the study duration, diminishing from 1274.56 km2 in 1990 to 1119.37 km2 in 2020, constituting a decrement of 12.17%. (2) Based on geographic detector outcomes, disparate driving forces underpin wetland dynamics across urban–rural gradients, with urban locales predominantly influenced by organic carbon and the proportion of impervious surface factors. Meanwhile, in agricultural and semi-ecological villages, silt is the primary factor, while ecological villages are primarily modulated by both silt and gross domestic product factors. Additionally, synergistic interactions manifest heightened explanatory power. This study elucidates the mechanistic underpinnings of wetland dynamics along urban–rural gradients, providing pivotal insights for developing targeted wetland restoration and conservation policies pertinent to the urban–rural developmental trajectory in Hefei City. Concurrently, it offers relevant recommendations for the multifaceted stewardship and sustainable development of wetlands in Hefei City in the foreseeable future.