I use a bag to keep pellet hops out of the bottling bucket when I have dry hopped. I put the bag over the end of the siphon tube that I put in the fermenter so the hop particles stay in the fermenter and don't get in the bottling bucket.
For many years I didn't use a bag, and still mostly kept the hops out of the bottling bucket, but a few got in there and would end up in the last couple of bottles. The hop particles act as nucleation points if they get in the bottles, and can cause the beer to gush out when you open the bottle.
Yes, you need to sanitize the bag.