No, resetting your iPhone to its factory settings won't alter your iCloud. When you reconfigure your iPhone, you'll have the option to reconnect to your iCloud account if you want. iCloud also stores iPhone backups from which you can restore your phone. Nothing will be deleted from your iCloud account.
After you enter your passcode or Apple ID, the iPhone will begin to delete its data, apps, and settings. This process will erase all of your personal information and restore your phone to its original factory settings. Erasing your iPhone won't delete your photos from iCloud. The photos in iCloud and the data in your iCloud account are separate from the data on your iPhone.
When you erase your iPhone, it only deletes the content from the device itself, not from the iCloud storage. If you want to delete photos from your iPhone but save them to iCloud, you can use the Optimize iPhone Storage option, which saves high-resolution photos in iCloud and only the smaller versions on your device to save space.