The photos on your iPhone take up space on your device regardless of whether you have iCloud or not. This is because iCloud is designed to store a copy of the photos from your iPhone in the cloud, making it possible for you to access them on other devices, but it does not replace the photos on your iPhone.
When you take a photo or video, it is stored locally on your iPhone in the Photos app. If you have iCloud Photo Library enabled, the photos are also uploaded to your iCloud account and available on other devices signed in with the same Apple ID. However, the original versions of the photos remain on your iPhone, meaning that they still take up space on your device.
To free up space on your iPhone, you can enable the "Optimize iPhone Storage" option in the iCloud settings. This will automatically remove full-resolution versions of photos and videos from your iPhone and replace them with smaller, optimized versions that take up less space. The full-resolution versions will still be available in iCloud for you to download at any time.