Bifurcations of limit cycles in planar differential and piecewise differential systems