There is a black mirror episode where a person puts an implant inside their brain that hears an echo of their brain wave activity. Once the implant essentially becomes that person, it's removed and put into a smart home device.
It's a three parter, an other bit has a criminals copy being tortured to get a confession out of it.
It's a Christmas special so it's a solid hour and a half.
I don’t suppose you mean Altered Carbon, where the premise is people don’t die as their entire memory and consciousness could be captured in a tiny tube the size of a modern day fuse; and opens where they’re investigating the suicide of a young woman who jumped to her death but have registered as DNR or something like that?
Similar style, but that was a mini-series (for lack of a better description).
This was a movie (IIRC), and she was held in a prison in her mind (so she thought), I can't remember the details. Futuristic, but not very far into the future.