The prevailing literature posits a linear relationship between urbanization and food security. Using a policy in China that promotes government-led urbanization through creating cities, specifically city–county merger, we show the existence of a non-monotonic relationship. Based on the time-dynamic results obtained using national county-level panel data from 2000 to 2020, a potential non-linear characteristic of both decreasing and increasing trends before eventually dissipating has been identified. Mechanism analysis demonstrates that the city–county merger negatively impacts food security by causing labor mobility and cultivated land factor loss. However, integrating regional markets fosters quality and efficiency improvement in agriculture. The effects of amplified resource pressure and efficiency gains have opposing impacts that vary over time, ultimately resulting in a non-linear relationship. These insights into the debate on urbanization and food security have important policy implications for regions worldwide that are experiencing rapid urbanization, particularly for developing countries.