Sounds like a safety lockout on the shifter, meant to prevent shifting out of Park until you press on the brakes, but the lockout mechanism/switch may be sticking/broken/jammed or just need lubrication. If you can't fix it, you could just remove the lockout entirely.