We study an analogue of the equations describing TE and TM modes in a planar waveguide with an arbitrary continuous dependence of the electric permittivity and magnetic permeability on coordinates with the stationary Schrödinger equation. The effective potential energies involved in the Schrödinger equation for TE and TM modes are found. In general, the effective potential energies for TE and TM modes are different but in the limit of a weak dependence of the permittivity and permeability on coordinates they coincide. In the case when the product of a position-dependent permittivity and permeability is constant, it means that the refractive index is constant, we find that the TE and TM modes are described by the supersymmtric quantum mechanics.