Capturing CO2 from natural gas and flue gas is of critical importance for energy conservation and achieving carbon-neutrality goals, yet it remains a significant challenge. Herein, we report two novel and stable 3D lanthanide MOFs, LCUH-123 and LCUH-124, which demonstrate remarkably selective CO2 adsorption over CH4 and N2, exhibiting excellent separation performance for both CO2/CH4 and CO2/N2 gas mixtures. LCUH-123's channel is obstructed by two coordinated DMF molecules, leading to near-complete blockage and a significantly reduced adsorption capacity. In contrast, LCUH-124's micropores are enriched with H2O-coordinated sites and free [(CH3)2NH2]+ cations, enabling superior gas adsorption and separation performance. Compared to LCUH-123, LCUH-124 exhibits significantly improved gas adsorption and separation performance, achieving higher selectivity coefficients for CO2/N2 and CO2/CH4 at zero coverage. Breakthrough experiments confirm that LCUH-124 serves as an efficient adsorbent for high-purity separation of CH4 and N2 from binary CO2/CH4 and CO2/N2 mixtures. Furthermore, its cost-effective synthetic process offers substantial economic advantages for large-scale applications. Theoretical calculations have elucidated the distinct adsorption and separation mechanisms of CO2/CH4 and CO2/N2 mixtures in LCUH-124. The exceptional performance of LCUH-124 stems from its rationally engineered pore architecture and cavity-directed coordination of water molecules with [NH2(CH3)2]+ cations within the channel.