Your contacts are automatically saved in your OneDrive, and will be restored after a hard reset or phone change.
You can found them opening a web page Hotmail. com, accessing with your account, then goiing to left squared icon -> Contacts.
On Google there are instruction for exporting them as a XML or TXT file, for importing in Google Drive Contacts or iPhone