Hops won't infect your beer ! It's a centuries old practise and proven.
I have done loads with sanitised hop bags, weighted and not waited, also done loads with loose whole and pellet hops. The biggest concern to me it the exposed bag material being in the damp environment exposed above the brew, but have never had an infection (hundreds of brews). It's quite common for the whole hops to float for a week or so. The pellet hops will also come to the surface for a few days, then sink. As the whole hops won't infect your brew, the safest is loose hops or loose pellets. The only difference the bag gives me is a slightly easier clean up at bottling.
Infection is from something in the whole brewing sanitation and environment control, not hops.