The rules for these two skills are unclear and overlap considerably. This means that the exact exact answer is "up to the DM". You do the verification that the DM decides is more appropriate. I will detail the way I chose them, this method is also used by each DM with whom I played. This also seems to be the method used by Matt Mercer, although I did not ask him to be sure.
Perception is to see
Verifying your wisdom (perception) allows you to spot, hear or detect the presence of something. It measures your general awareness of your environment and the liveliness of your senses. – PHB
Perception checks are based on your senses. Can you see, hear or feel something that could reveal the location? An example of how this can be used to find hidden doors:
You stand in the center of the room, take a look around you to spot traps, triggers and anything else that interests you. You feel a light breeze blowing from the library in the corner.
It's a Perception check. It's a measure of your ability to notice things from sight or sense.
The survey is for research
When you search for clues and make inferences based on these clues, you perform a check (survey). – PHB
Investigation checks consist of using logic and reasoning to determine where the trap or secret door is. It's a narrative rather than a mechanical difference. An example of description that a DM can give:
You hunt around the room, methodically checking each shelf, closet and wall sconce looking for a hidden switch. You find scratches on a certain section of the ground and deduct that the library needs to switch.
It's a Investigation check. This is a measure of your ability to think logically and methodically to locate something. You use the clues to find out where the secret door is.
I believe that confusion is coming for the green text block in the Perception section of the capacity checks. In this section, there is the text below regarding perception checks (that's me underlining):
… looking at the walls and furniture for clues, […] you opened drawers or search the office … – PHB
This text seems to contradict the non-green descriptions of these two skills. I can not explain why WotC chose to include this, but I can try to explain the difference despite this.
The investigation is your ability to think and reason on the basis of evidence. Perception is your ability to find that proof with your senses. A deputy minister could possibly ask for both checks for a particularly difficult situation. It is more likely that you decide what is the most difficult: find the proof or understand it. Then call for the appropriate control.
This method is the way I've always treated it at the table, as my DM does. Players and DMs always seem to have a good idea of situations that need control and this has never been a problem.