BackgroundDepression and anxiety disorders are increasingly prevalent worldwide due to ongoing economic and social transformations, positioning them as major mental health concerns. Research indicates that favorable natural environments and high-quality social interactions can positively affect residents' mental health and well-being. However, studies exploring the mechanisms through which environmental perceptions influence depression and anxiety are still limited. MethodsThis study utilizes data from the Health Life Satisfaction Survey of Yangtze River Phase II Delta (HLSSYRD II), collected between December 2023 and January 2024. Linear mixed-effects models were employed for data analysis. ResultsA total of 1,752 observations were included in this study. The mean score for the "Depression and Anxiety (HAD)" variable was 26.01 (SE = 6.99), with "Depression" scoring 13.15 (SE = 3.78) and "Anxiety" scoring 12.85 (SE = 3.75) among individuals in the Yangtze River Delta, China (YRDC). There was a strong negative correlation between depression, anxiety and environmental perception (beta = -0.187, SE = 0.03, p < 0.001; beta = -0.152, SE = 0.03, p < 0.001). Furthermore, social interaction significantly mediated the relationship between environmental perception and HAD. In addition, factors such as gender, chronic illness, marital status, occupation, level of education and monthly personal income were associated with depression and anxiety. ConclusionsIndividuals with poorer environmental perceptions were more likely to experience symptoms of depression and anxiety than individuals with better environmental perceptions in the YRDC. This relationship is partly moderated by social interactions.