If you need to reset your iPhone to factory settings to resolve an issue, you can back it up to iCloud first and then restore ...
Unboxing a new iPhone shouldn't make you anxious about whether your information will safely transfer to the new phone. These are the ways to do it easily and safely.