In the United States, you can be prosecuted in some states for drug possession if your prescription has expired and you still have the drugs [1]. This has not been sufficiently tested with the Supreme Court so you could eventually win on appeal but not before spending lots of money and time behind bars.
[1] https://edfolsomlaw.com/2013/01/illegal-possession-of-your-o...