In this study, we explored the synergistic impact of position-dependent mass and magnetic field on the electronic and optical properties of quantum wells, featuring an enhanced Tietz potential confinement incorporating both standard Morse and improved Rosen–Morse potentials, as influenced by variations in the structural parameter. Calculations were conducted within the framework of effective mass and parabolic band approximations. The diagonalization method was employed, selecting a wave function basis of trigonometric orthonormal functions to determine the eigenvalues and eigenfunctions of the confined electron potential. Our findings reveal that alterations in the sizes and shapes of the quantum wells, magnetic field strength, geometric asymmetry, and confinement parameters lead to significant variations in electron energies, transition between electron states, and the absorption spectrum. These outcomes offer valuable insights for investigating the electronic and structural properties of materials and devising novel materials with tailored optical characteristics.