If you upgrade your phone with the same network provider, you’ll keep the same number. Make sure you check this beforehand though and ask them if it isn’t clear.
If you’re changing providers, you can ask if you can keep your same phone number. Your previous network is legally required to release your number and allow your new network to use it for you.