Change all the contacts from Phone to Account. When you put that gmail account into the new phone it will sync your contacts.
Or, if you're buying the phone in a store, ask them to transfer the contacts for you.
Or use an app like Super Backup. Back your contacts up to your SD card. Put that card into the new phone and restore the contacts.
Or export the contacts to a file. Use that file to import to Google Contacts
. (Pull down the More box.)