iCloud Photos is a syncing service. Any photo you delete from a device where iCloud Photos is turned on will also be deleted from iCloud and from any other device connected to iCloud Photos. You can potentially reduce the storage space required on a device by turning on Optimize Storage. See: https://support.apple.com/en-us/HT204264
Apple does not currently offer cloud-only storage for photos. If that is what you want or need, you may want to explore 3rd party options such as Google Photos or Dropbox.
If you are trying to clear the old phone, you can use the following procedure and it will not erase any photos on iCloud or on your new phone: What to do before you sell, give away, or trade in your iPhone, iPad, or iPod touch - Apple Support