A new result on averaging theory for a class of discontinuous planar differential systems with applications