To backup your contacts with iCloud,
you must be connected to the internet
and know your Apple ID and password.
First find the Settings app
Then choose iCloud
Sign into iCloud with your Apple ID and password
Next to Contacts turn on the toggle button
and make sure its green
When it says “Your contacts will be merged with iCloud,” click Merge
Your contacts will now sync and be saved to your iCloud account. Any new contacts will be synced automatically.
If you get a new iPhone you can restore your contacts by signing into iCloud with your Apple ID.