Average citizens have rights against unlawful searches and seizures. The Fourth Amendment of the United States Constitution prevents police from randomly searching people's homes and cars.
At the end of the day, the police cannot search your car on a whim. Even if the cops pull you over on suspicion of drunk driving or anything else, they need a warrant to search a vehicle. However, there are circumstances under which the cops do not need to have a warrant, but specific criteria need to be present.
Circumstances that can warrant a search
Lacking a search warrant, police in California need to have the driver's consent to search a vehicle. A police officer can always ask to search a car, and in the event the driver grants permission, anything illegal the police find can serve as evidence in court. That is why drivers need to remain prudent and never grant permission for the police to search a car if no warrant is present.
Additionally, the cops can search a car if there is probable cause that the vehicle contains evidence of a crime or unrelated contraband. For example, the police may spot a bag of what they perceive as drugs in the passenger seat. This would give the cops enough reason to search the rest of the vehicle to see if other illegal substances are onboard.
Once the police have lawfully arrested the driver, they can then search the vehicle if they believe it relates to the crime at hand. After an arrest, the car will likely go to an impound lot. This will happen no matter what if the arrest is a result of driving with a suspended license. Once it is at the lot, the police can search the car for an inventory search. They merely see what items are within the vehicle, but if they find illegal substances, then it could add to the driver's charges.