We show that a Schrodinger-like differential equation for the upper spinor component, derived from the Dirac equation for a charged spinor in spherically symmetric electromagnetic potentials, can be transformed into the Schrodinger equation with some shape-invariant potentials. By choosing different electrostatic potentials and relativistic energies and also introducing new functions and changing the variables, we show that this equation transforms into the differential equations in mathematical physics. We solve these equations using the master function approach and write the spinor wave functions in terms of Rodrigues polynomials associated with these differential equations.