We study two-dimensional (2D) Dirac fermions in the presence of a periodic mass term alternating between positive and negative values along one direction. This scenario could be realized for a graphene monolayer or for the surface states of topological insulators. The low-energy physics is governed by chiral Jackiw-Rebbi modes propagating along zero-mass lines, with the energy dispersion of the Bloch states given by an anisotropic Dirac cone. By means of the transfer matrix approach, we obtain exact results for a piecewise constant mass superlattice. On top of Bloch states, two different classes of boundary and/or interface modes can exist in a finite-size geometry or in a nonuniform electrostatic potential, respectively. We compute the dispersion relation for both types of boundary and interface modes, which originate either from states close to the superlattice Brillouin zone (BZ) center or, via a Lifshitz transition, from states near the BZ boundary. In the presence of a potential step, we predict that the interface modes, the Bloch wave functions, and the electrical conductance will sensitively depend on the step position relative to the mass superlattice.