Learnable Conformal Prediction with Context-Aware Nonconformity Functions for Robotic Planning and Perception