When a police officer shows up at your door and asks to enter your home, you are fully allowed to deny entry and refuse to give consent. You do not have to let them come in and search your property.
To get in without consent, they must have a search warrant. They can get it from a judge prior to arriving at your house. If they tell you that they have one, ask them if you can see it and they should easily be able to prove that they did follow the proper steps. If they don’t have the warrant, you can just ask them to go get one before coming into your home.
There is one major exception to this general rule, which is that they can enter the home without consent and without a warrant under “exigent circumstances”. This generally means it’s an emergency. For instance, if the police are involved in a chase and the suspect gets out of the car and runs into a building, they can continue the pursuit. They may also be able to do so if they think someone is in danger or that evidence may be destroyed if they do not enter immediately.
The thing about a warrantless search, though, is that they’ll have to show it was justified after the fact. Getting a warrant means they justify it first, and the judge agrees. If they can’t justify it afterward and the judge determines they shouldn’t have conducted the search, evidence obtained may be thrown out of court.
If the police violated your rights while searching for evidence or making an arrest, be sure you fully understand your legal options.