I believe it only applies on major settled planets like Neon, etc. and again it is only on arrival to the planet.
If it is any other planet in a system controlled by a faction they don’t scan because there’s no need for a major security presence. For example, if I ever run afoul and end up with a bounty I have an outpost built on Maheo which is freestar collective jurisdiction, but there’s no one to scan me when I go there. Drop down to outpost, clear bounty, on my way.
With regards to if you are smuggling, either get a signal jammer from the Crimson Fleet, or shielded cargo pods from any of the ship vendors that sell them. The easiest is might also just to sell any contraband before you leave the planet you are on to the Trade Authority. If you are already on a settled world you can offload all your illegal goods before hitting atmo. Plus they don’t scan you on the way out so you can always just set a course for somewhere more neutral like the Wolf’s Den.