it's often used that way, but it is also used by a vessel in trouble/distress that is not in immediate danger. For instance my engine on a boat stops working, no immediate danger and I would make "pan pan, motor vessel scuba diver is disabled and not under power, request assistance for a tow" then as I drift lets say the boat starts sinking or starts to get driven towards something by the wind/current, then the appropriate radio call is "mayday, Mayday, motor vessel scuba diver is sinking, I am located at (insert location)
That is how it should work, in practice, too may use mayday when Pan Pan is appropriate.