Whenever the police stop you and have reasonable grounds to suspect that you may have a weapon they are allowed to conduct a "pat-down" or "frisk" of outer clothing to check for weapons.
If you are merely stopped in your car and issued a traffic citation the police generally cannot make a general search of the vehicle unless there is probable cause to believe there is contraband or evidence of a crime located in it.
If you are arrested in connection with a traffic stop, incidental to the arrest, officers may generally search the interior of the vehicle and any containers or compartments.
If you are arrested in your home, incidental to the arrest, the officer can make a search of the immediate area for weapons and evidence without obtaining a search warrant. In some cases they may be allowed to make a protective "sweep" of he entire residence to assure there are no accomplices, or anyone else present who might present a danger to the officers. Any contraband such as narcotics, drug paraphernalia, weapons stolen property, or evidence of a crime can be seized.