You could definitely bring them back to a pharmacy. But It might be better to give them to a trusted loved one who will give them to you when they know you need them. Although if you have a doc that wrote the script for you, they’d almost certainly do it again next time, assuming you go through a similar surgery.
There’s a lot of talk about pain meds, but tbh docs are still willing to give them out. Docs are trained in red flags but anyone looking at your record would see someone who legit needs it.