The main aim of the present paper is to solve the eigenvalues problem with the Bohr collective Hamiltonian for $\ensuremath{\gamma}$-rigid nuclei within a model we have elaborated by combining two model approaches: the quantum mechanical formalism, namely, deformation-dependent mass formalism (DDM), and the anharmonic sextic oscillator potential for the variable $\ensuremath{\beta}$ and $\ensuremath{\gamma}=0$. The model developed in this way is conventionally called the sextic and DDM approach. Analytical expressions for energy spectra are conjointly derived by means of quasiexact solvability and a quantum perturbation method. Due to the scaling property of the problem, the energy and $B(E2)$ transition ratios depend on two free parameters apart from an integer number which limits the number of allowed states. Numerical results are given for 35 nuclei---$^{98--108}\mathrm{Ru}, ^{100--102}\mathrm{Mo}, ^{116--130}\mathrm{Xe}, ^{180--196}\mathrm{Pt}, ^{172}\mathrm{Os}, ^{146--150}\mathrm{Nd}, ^{132--134}\mathrm{Ce}, ^{154}\mathrm{Gd}, ^{156}\mathrm{Dy}$, and $^{150--152}\mathrm{Sm}$---revealing a good agreement with experiment. Moreover, as proved for the first time by Bonatsos et al. [D. Bonatsos, P. Georgoudis, D. Lenis, N. Minkov, and C. Quesne, Phys. Lett. B 683, 264 (2010)], the dependence of the mass on the deformation with the sextic potential moderates the increase of the moment of inertia with the deformation, removing an important drawback that has been revealed in the constant mass case [Buganu and Budaca, J. Phys. G: Nucl. Part. Phys. 42, 105106 (2015)]. Additionally, the correlation between the DDM and the minimal length formalism persists for the sextic potential. Finally, the DDM effects on the shape phase transition for the most numerous isotopic chains, namely, Ru, Xe, Nd, and Pt, have been duly investigated.