I don't know if this is safe to do these days given that the laws have become so draconian in some states (Helloooo Wisconsin!), but when I bought my first car that wasn't from a family member, I found drug residue in it.
This was during the 70s. I took the car down to the police department and explained that I had JUST bought the car, found "powder" in it, and could they have their dog go over it without me getting in trouble for anything they found.
Turns out they would do that for me, with the caveat that I had to submit to a sniff over by the dog as well. I was clean, so no problem.
Car not so much: Heroin and cocaine residue, and 1/4lb of cheap weed underneath where the body attached to the undercarriage
Cops confiscated the drugs, I got a pat on the ass for being a good citizen, and I didn't have to worry about going to jail for a few years for drugs I didn't even know were there.