In many cases schools are legally considered in place of parents meaning they can give certain consents for the underage attendees such as approving of search and seizures of their private property. https://www.law.cornell.edu/wex/in_loco_parentis
The school isn’t private propery, but the backpack/bag is what they were calling private property. Unfortunately parents sign away just about all of their kids rights when they sign them up for school.
As for my experience, they would show up a few times a year, usually because someone ratted out someone for having drugs. They would walk the dog through the halls by the lockers when we were in class. It was rare to ever encounter one of the dogs. If you were the one that got ratted out you would have been pulled out of class. The worst I had experience with was an upset girlfriend whom stuck a gram of weed between the backseat cushions of the car her boyfriend was driving. She reported him as having drugs in his car and he got expelled… over a gram of weed that he didn’t know existed.
The right to search your car I believe you have to grant to get a parking permit, which once again is walking the line with shouldn’t be legal.