This is the "switch-loop" end of a 3-way switch loop circuit. You cannot fit a receptacle because they need hot and neutral, which are not present here.
Use a smart switch
This circuit can be rewired using smart switches to provide hot and neutral here.
In that case, white and black would be re-assigned to be hot and neutral. The red wire would become a communication wire, if your smart switch type requires it. Typically "smart" 3-ways are made as a master and remote; the remote would be here.
That would provide the hot and neutral which the receptacle also requires.
It's really hard to understand 3-way circuits because all wires are black, white and red. They seem to do all different things. Those colors are only used because that's how the cable is manufactured. You can make things a lot clearer by marking electrical wires by function. A 5-pack of electrical tape makes this easy. Mind you, if neutral is present, it must be on the white wire. Otherwise, tape away, but mark each wire the same on both ends. I like
- black for always-hot, as to a receptacle
- red for switched-hot to a lamp
- yellow for both travelers. There isn't really any need to tell them apart.
Now it looks like this. Now it's clear what those wires are doing, none are hot or neutral, and that's why your receptacle can't work.
Lastly, there's a way to do this with "old fashioned relays". It's what Tesla would do in 1910, but smart switches are easier so I'm excluding the details. If you want them, ask.