I encountered the similar problem of unable to share some photos. I was notified of my lack of storage space on the cloud for a while now as I had the 50GB storage plan.
First thing I tried was to log out and log back into Icloud on my iphone. This didn't work as I realised I lost over 5000 photos!!! I then decided to pay for the 200GB iCloud storage plan and waited to see if some miracle occurred. While waiting I searched on Apple Support for further help and noticed they mentioned once you are signed into ICloud all your photos and videos are saved. You can also access them via a web browser. So i went on my pc and logged into ICloud.com and as stated all my photos and videos were there!!!
I eventually went back to my phone and all my photos and videos came back and I was able to share them.
It may be that increasing the ICloud storage plan helped but all my photos and videos were present on the cloud via ICloud.com on my pc.
One more thing, I was also using google photos to backup my photos and videos. While backing up on the app it notified me of some photos and videos did not back up. This was how I found out I could not share some photos which led me to investigate.
Hope this helps someone.
Robert