Search/Detect. Depending on the nature of your search, the GM might have you make one of the following checks:
When you search for something hidden (secret door, concealed trap, suspected enemies waiting in ambush, hidden key), you usually make a Wisdom (Perception) check. This involves use of your senses (sight, hearing, touch, etc.)
Success in Searching.
If you search for an object, your check total is compared to the DC as determined by the GM.
If you try to discover any hiding enemies, your Wisdom (Perception) check is contested by any hiding enemy's Dexterity (Stealth) check.
One of the main factors in determining whether you can find a foe or object is how well you can see in an area, which might be lightly or heavily obscured.