I've had both a Betta and Pea Puffer in my five gallon cube.
My Betta was pretty active and would constantly patrol the tank. He did not like the nerite snail I bought at first and flared & tried to bite him a few times, but he eventually stopped doing it. I think he would have killed any shrimp I had in there, so I would recommend starting with a couple of ghost shrimp and seeing what happens. They're cheap and worse case scenario he gets a nice snack. 😋
My pea puffer is pretty shy and he likes to hide in the vegetation in the tank, only occasionally coming out. He hasn't attacked either of the nerite snails where they're so much bigger than him but he wiped out the pest snails in my tank really quick. I think he also would kill shrimp as well, especially where he moves faster then my Betta did. I would consider them a bit more demanding to take care of than a Betta so keep the food requirements in mind.
I loved both of mine so regardless of which one you choose you should be pretty happy. 🙂 There does seem to be some controversy about only having one pea puffer by itself (which in a five gallon is all you should have), so do your research on that and decide what's best.