It disassociates your Apple ID with that particular phone. It doesn’t get rid of your Apple ID all together. Erasing all contents and settings gets the phone ready for the new person essentially. It’ll be like they went to an Apple Store and bought a brand new one. Once the phone erases, resets, and boots back up, it’ll look like the phone has been turned on for the first time.