If a police officer asks to search your home or your car you should always say no. You have a constitutional right to say no to not consent to any search and they can’t search your car, your home, or your person without your permission unless there are certain legal standards met allowing them to do so absently consent.
What happens often is the officer does not have legally sufficient reason to search you, your car, or your home so they’ll ask for permission. If you give them permission then it’s legal for them to search and anything they find can be used against you. But, if you exercise your right to say: “No, I don’t consent to any search” then they can’t search unless they have certain legal reasons to do so. Quite often they don’t, and then if they find something it was illegally obtained and cannot be used against you.