Erasing your personal data from an old phone, before you recycle or give to someone else is very important, otherwise, someone else might have access to your data. Also, if your old phone is not deregistered, then that phone is still tied to your account and someone else can NOT use that phone. There is so many version of Android devices out there, and this process is for Samsung, but the process might be similar for other Android devices. It’s two-step process one erase your personal data, then deregister, so that you are old no longer tied to your account. In case you are looking to reset your iPhone, I have written post check it out Erase your personal data from an old iPhone
Deregistering your old phone from your account
Go to settings>Lock Screen and Security>Find My Mobile
Then deselect all your account, you can also remove it by sign-in to your https://findmymobile.samsung.com account, then selecting your old phone to be removed.
Factory Data Reset
If you giving your old phone to someone else or recycling you must deregister from your account. Then do factory reset.
Go to settings>General Management
Then select Reset
Then select Factory Reset Data, it will list all your data that will be erased from your phone, at the bottom of screen press Reset
Once you have done deregistering and factory reset of your old phone, then you are all set. Note this does not mean your data can’t be recovered 100%, by using some kind of software, but at least it’s safer then having someone pickup your old phone and have full access. Also, recommended to change your account password, so in case someone does try to recover your data and tries to access your account, you might get alert depends on what kind of application, someone trying to use your account.