The Dirichlet problem for a singularly perturbed elliptic equation on an n-dimensional layer is considered. When the parameter multiplying the leading derivatives vanishes, the elliptic equation reduces to an equation of zero order and the boundary function develops a discontinuity of the first kind. A special difference scheme is constructed for the boundary-value problem, the scheme being uniformly convergent with respect to the parameter. Rectangular grids, the density of which increases in a special way in the vicinity of the boundary and in the vicinity of the line of discontinuity of the boundary function, are used to construct the scheme. Moreover, special difference operators with fitting coefficients are used. The fitting coefficients are constructed from the condition that the grid approximation of the solution of the Laplace equation should be sharp for a discontinuous boundary condition. The results obtained are used to construct a scheme for a parabolic equation with discontinuous boundary condition.