With iCloud Photos, all of your photos are on iCloud and also on your iPhone (and other devices if you have iCloud Photos turned on in those). You can potentially reduce the storage needed on your iPhone if your phone is low on storage (but not to zero) by using the Optimize option. See the following from Set up and use iCloud Photos - Apple Support
iCloud Photos keeps all your photos and videos in their original, high-resolution version. To save storage space on your device, you can turn on Optimize Storage.
If you turn on Optimize Storage, iCloud Photos automatically manages the size of your library on your device. Your original photos and videos are stored in iCloud and space-saving versions are kept on your device. Your library is optimized only when you need space, starting with the photos and videos you access least. You can download the original photos and videos over Wi-Fi or cellular when you need them.