Ok. Download the app My Contacts Backup. (If you have more than 500 contacts to transfer you will need the “Pro” version.) Use the app to back up the contacts on your phone as a vCard attachment to an email that you send to yourself. Confirm that you have received the email. Then go to Settings>iCloud, turn Contacts off, choose Delete from My iPhone when prompted, after 30 seconds or so turn Contacts back on and choose Merge if prompted. Check the contacts on your phone. If they are still on your phone, go to icloud.com to see if they are there too. If they are, add a new test contact and see if it appears on icloud.com now. If it does, your phone should now be properly syncing contacts with iCloud.
If the contacts are not on your phone, go to Settings>Mail,Contacts,Calendars>Default Account (in the Contacts section) and confirm that it's set to iCloud. Then open the My Contacts Backup email and tap the attachment to import the contacts back to your phone. Confirm that they now appear on your phone, then check icloud.com to confirm that they appear there too. If so, add a new test contact and see if it appears on icloud.com now. If it does, your phone should now be properly syncing contacts with iCloud.