The paper concerns the study and applications of a new class of optimal control problems governed by a perturbed sweeping process of the hysteresis type with control functions acting in both play-and-stop operator and additive perturbations. Such control problems can be reduced to optimization of discontinuous and unbounded differential inclusions with point-wise state constraints, which are immensely challenging in control theory and prevent employing conventional variation techniques to derive necessary optimality conditions. We develop the method of discrete approximations married with appropriate generalized differential tools of modern variational analysis to overcome principal difficulties in passing to the limit from optimality conditions for finite-difference systems. This approach leads us to nondegenerate necessary conditions for local minimizers of the controlled sweeping process expressed entirely via the problem data. Besides illustrative examples, we apply the obtained results to an optimal control problem associated with of the crowd motion model of traffic flow in a corridor, which is formulated in this paper. The derived optimality conditions allow us to develop an effective procedure to solve this problem in a general setting and completely calculate optimal solutions in particular situations.