If you use iCloud Photo Library and have not set it up correctly, you may not be able to delete photos from your iPhone. To fix this issue, go to Settings > iCloud > Photos on your iPhone and make sure that iCloud Photo Library is enabled.
To avoid running out of storage space on your iPhone, it's important to regularly delete photos after importing them to your computer. You can also use cloud storage services like iCloud or Dropbox to store your photos, allowing you to free up space on your phone without losing your photos.