The process of how objects float can be a little tricky to wrap your head around. They need to have positive buoyancy (being less dense than the fluid in which it is sitting). You probably already know the answer to, “do cell phones float”. If you have ever dropped yours in a pool, you know they do not have positive buoyancy and do not float.
With waterproof cases, you can actually get them to float. If you place a few pieces of toilet paper inside of the case, without obstructing the view of your screen, it can create a density that is less than the water. But, this will not always be the case. There are a lot of factors that go into play, but you can test it out at your home.
Be wary, though, that water density can alter based on the temperature. This means that just because it floats in your bathtub, it may not do so in the ocean.