State-wise Safe Learning and Control