One caution - if iCloud Photos is enabled on the iPhone, the iCloud backup of the iPhone does no longer contain the photos (What does iCloud back up? - Apple Support). Using iCloud Photos makes it harder to get a backup of the photos at all. The iCloud backup will no longer include the photos and videos and even the backup on a computer can only save the photos and videos that have been downloaded to the iPhone, not the "optimized" photos, where the originals have been removed to iCloud.
With iCloud Photos enabled we have to save the photos regularly manually on a computer by downloading them from iCloud, as the easy backup methods are no longer saving the photos. So do not delete any photos from your your devices that are important to you, unless you have checked, that you are having at least one copy of the photo on a computer plus a safety copy.
To save storage on your devices the only way to do this without loosing the photos, is the "Optimize Storage" option for iCloud on a Mac or iPhone. iCloud will remove automatically high resolution originals from the iPhone, when the device has no longer sufficient free storage. This can reduce the amount of storage used your your photos to 10% of the size used in iCloud. But you will still need the storage for the optimized versions. You cannot remove the photos completely from your iPhone using iCloud. Let the iPhone and iCloud manage the storage an do not delete photos yourself, unless they are not worth keeping.