Long-duration commuting is widely recognized for its significant influence on health. However, while research has traditionally focused on direct impacts, there remains a critical need to explore the nonlinear dynamics of this relationship. This study aims to deepen our understanding of how behavioral preferences and built environments contribute to these complex interactions. This study was conducted in Jinan, China's most congested city, using data from the "Jinan Residents Commuting Survey" of 1,755 participants aged 19 to 59. We applied Generalized Propensity Score Matching (GPSM) to explore the nonlinear effects of commuting time on self-rated health, adjusting for participants' sociodemographic characteristics. Variables related to active commuting, physical activity, and perceived built environment were also examined for their potential moderating effects. Commuting for less than 21 minutes enhances health, but negative effects intensify and peak at 60 minutes. Heterogeneity analysis reveals that women and older adults, especially those with higher incomes, are more susceptible to long commutes, experiencing a delayed onset of adverse effects. While active commuting offers health benefits, it may exacerbate health issues if prolonged. Conversely, regular physical activity consistently improves health outcomes related to commuting. Additionally, factors like residential greenery and walkability help alleviate commuting-related stress, improving the overall commuting-health dynamic. This study clarifies the commuting-health relationship by identifying key time thresholds and the positive effects of active commuting and physical activity on mitigating longer commute impacts. The findings inform healthier commuting behaviors and offer practical guidelines for urban planning and policy-making to enhance commuter well-being.