Dynamics of First-Order Phase Transitions in Equilibrium and Nonequilibrium Systems