Deleting pictures in Photos is not a safe way to remove them only from an iPhone when iCloud Photos is turned on. The deletion syncs to the iCloud Photos library and other devices using that library.
- Open Settings > [your name] > iCloud > Photos.
- If your goal is simply to save device space, keep iCloud Photos on and choose Optimize iPhone Storage instead of deleting pictures.
- If you truly want to stop using iCloud Photos on this iPhone, review the download/remove choices shown before turning syncing off. Make sure the originals you want to keep are safely stored elsewhere first.
- Only delete local copies after you have confirmed that your separate copy or backup is complete.
Do not experiment with deletions on irreplaceable photos. A synced deletion can propagate to your other Apple devices.