A Ziploc bag is a thin bag made of two sheets of plastic heat-sealed around the edges. It can be zipped closed with a seam seal. The plastic is waterproof and therefore it can make your phone waterproof, but not for very long.
The longer the Ziploc bag is underwater, the more the harsh saltwater will corrode the plastic. Plus, the pressure of the water can also cause the bag’s seams to pull apart.
So, using a Ziploc bag to waterproof your phone is not the smartest idea. However, it is a decent option if you’re on a budget and are willing to risk your electronics. It might work perfectly, but it is a little risky.