iCloud storage is not a substitute for adequate storage on a device but may help in some cases. See About storage on your device and in iCloud - Apple Support
including the following from that link:
Free up space on your device
You can make storage space available on your iPhone, iPad, or iPod touch when you use iCloud Photos and turn on Optimize Storage. Or you can remove content from your apps—like photos, music, and Podcasts—or delete the apps that you're not using.
Regarding deleting photos, 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: Set up and use iCloud Photos - Apple Support
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.
Another way that photos may be on iCloud (if you don’t have iCloud Photos turned on) is via a backup of an iOS device. The only thing you can do with a backup is use it to restore a device or set up a new device. The contents of backups are not viewable at iCloud.com and if you delete a photo from a device it will not be included in future backups and will be lost.