We consider the quantum theory of paraxial nonrelativistic electron beams in nonuniform magnetic fields, such as the Glaser field. We find the wave function of an electron from such a beam and show that it is a joint eigenstate of two ($z$-dependent) commuting gauge-independent operators. This generalized Laguerre-Gaussian vortex beam has a phase that is shown to consist of two parts, each being proportional to the eigenvalue of one of the two conserved operators and each having different symmetries. We also describe the dynamics of the angular momentum and cross-sectional area of any mode and how a varying magnetic field can split a mode into a superposition of modes. By a suitable change in the frame of reference, all of our analysis also applies to an electron in a quantum Hall system with a time-dependent magnetic field.