You can save photos or videos to iCloud by turning on iCloud Photos in your device settings. Once it's turned on, your photos and videos will be automatically uploaded to your iCloud account, and you can access them from any device signed in to your iCloud account. This will allow you to safely delete them from your iPhone or iPad without losing them.