If you have iCloud Photo Library turned on for your iPhone, then if you delete photos from the phone, they will be deleted from the iCloud Photo Library. That means that your phone, iCloud, and any other devices signed into that account with iCloud Photo Library turned on will have the photos deleted.
There is one library. If you do anything to it from any device or computer connected to it, that change, whether it be adding new photos, editing photos, or deleting photos, will be reflected across any device or computer using that library.
iCloud is a syncing/sharing service, not an archival one. So, you would need to turn off iCloud Photo Library on the iPhone in order to do what you are asking.
Be sure that you have Optimize Photos turned on under Settings>Photos. That will enable the automatic management of the library size on your device. iCPL will remove older full-resolution photos from your iPhone and replace them with thumnails when your space becomes low.
iCloud Photo Library Help - Apple Support
iCloud Photo Library - Getting Started
Best,
GB