If you are using iCloud Photos on your iPhone, you must not delete any photos from the iPhone, that you want to keep. iCloud is a syncing service and not primarily an external storage. The library on your iPhone will always be kept identical to iCloud. Any photo you delete from the will be deleted from iCloud and any other synced device as well.
The only way to save storage on your iPhone with iCloud Photos is the "Optimise iPhone Storage" option. Then iCloud will automatically remove some of the high resolution originals from the iPhone and replace them by smaller versions for browsing. You can save some storage this way, but remove the photos from the iPhone completely. If you want to remove the photos completely, you need a different service.
You could disable iCloud Photos on the iPhone, and then delete all photos, and they will stay in iCloud. But you will no longer be able to see them on the iPhone, only on other devices.
This link explains, what iCloud Photos could do for you and what not:
Three Good Reasons for Using iCloud Photos Library and when not to use it - Apple Community