Stabilized Neural Differential Equations for Learning Dynamics with Explicit Constraints