We investigate the Goos-Hänchen shift for ballistic electrons (i) reflected from a step-like inhomogeneity of the potential energy and (or) effective mass, and (ii) transmitted through a ferromagnetic barrier region in monolayer silicene or gapped graphene. For the electrons reflected from a single interface we found that the Goos-Hänchen shift is valley-polarized for gapped graphene structure, and valley-and spin-polarized for silicene due to the spin-valley coupling. Incontrast, for example, to gapless graphene the lateral beam shift in gapped structures occurs not only in the case of total, but also of partial, reflection, i.e. at the angles smaller than the critical angle of total reflection. We have also demonstrated that the valley-and spin-polarized displacement of the electron beam, transmitted through a ferromagnetic silicene barrier, resonantly depends on the barrier width. The resonant values of the displacement can be controlled by adjusting the electric potential, the external perpendicular electric field, and the exchange field induced by an insulating ferromagnetic substrate.