Yes, cancel your phone number and SIM card before leaving. If you don't, the number may be recycled and resold to someone else, which can affect your WeChat login and your digital accounts linked to that number.
Nationwide (all cities)
You should cancel it
Yes, you should cancel your phone number and SIM card before leaving China. The Guangzhou Liwan District government lists this as one of the 14 things foreigners need to do before leaving.
The risk
The core risk is that an un-cancelled number is not simply left dormant. If the number is eventually recycled and reassigned to another user, that person could gain access to accounts tied to your old number. In practice this matters most for WeChat, which is commonly bound to a phone number and used for login and payments; if your number is reissued, your WeChat login could be affected. The same concern applies to any other digital account, including Alipay, that you bound to that number.
Two steps
So the safe move is to cancel the SIM card and disassociate the number from your phone before you leave. The Liwan District government's list specifically includes both 'disassociate your phone number' and 'cancel phone SIM card' as separate items, so treat them as two steps: first unbind the number from your accounts, then cancel the SIM card with the carrier.