Detecting a Hazard
During exploration, determine whether the party detects a hazard when the PCs first enter the general area in which it appears. If the hazard doesn't list a minimum proficiency rank, roll a secret Perception check against the hazard's Stealth DC for each PC. For hazards with a minimum proficiency rank, roll only if someone is actively searching (using the Search activity while exploring or the Seek action in an encounter), and only if they have the listed proficiency rank or higher. Anyone who succeeds becomes aware of the hazard, and you describe what they notice.
Magical hazards that don't have a minimum proficiency rank listed can be found using detect magic, but this spell doesn't provide enough information to understand or disable the hazard—it only reveals the hazard's presence. Determining a magical hazard's properties thoroughly enough to disable it requires either the use of more powerful magic or a successful skill check, likely using Identify Magic or Recall Knowledge. Magical hazards with a minimum proficiency rank can't be found with detect magic at all.