Plastic bags can not be dumped overboard, no matter how far out to sea you are. The plastic will continue to float along as it breaks down into fine particles of plastic that accumulate in the ocean trash gyres.
Plastic grocery bags serve a second purpose on board a sailboat, they make excellent trash bags for tiny homes. Their handles let them hang from the galley and when they are full, they can be tied up to avoid spills. While in port, plastic trash bags can be taken to the marina dump to dispose of them. While sailing, I tie them up to the davits on the transom, ready to be disposed at the next appropriate landfall.
This is all well and fine, as long as you can properly store the plastic bags in an easy to access location that keeps them safe so they don't fly away. An empty bag will fly around in the slightest of breeze and can blow overboard far too easily. I have found an easy way to store the bags, I stuff them in this cloth tube which has elastic around the openings at the end.
I ball the bag up and stuff it in the top when I unload my groceries. When I need a bag, I simply pull from the bottom. The whole tube hangs from the ceiling next to the galley, near the companionway.
I have never had a bag get free from this device, yet they are always at the ready and accessible. Recycling plastic bags consumes a lot of energy; by reusing them, their useful purpose can be extended until they are ultimately disposed of.