Spherically symmetric anisotropic solutions that describe compact stellar objects within the framework of modified Rastall (Formula presented.) gravity are explored in this manuscript, where the non-metricity scalar represented by (Formula presented.) and the trace of the energy-momentum tensor is denoted by (Formula presented.). To achieve this, the Karmarkar condition is applied and a relationship between the metric functions to solve the resulting field equations is established. In this framework, the field equations are constructed and the behavior of (Formula presented.) under two different scenarios is investigated. In the first scenario, a hybrid form (Formula presented.) is employed along with a linear equation of state (Formula presented.), where (Formula presented.) and (Formula presented.) is an arbitrary constant, to derive the corresponding (Formula presented.). In the second scenario, a logarithmic form of the coupling function (Formula presented.) is considered. The objective is to explore possible modifications to gravity by varying the parameters (Formula presented.) and (Formula presented.) in both cases, leading to hybrid, power-law and exponential forms of gravity. The Key physical parameters such as matter variables, anisotropy, gradients, the equation of state parameter, mass function, energy conditions, and stability criteria to assess the physical acceptability of the models are explored. The observational data such as the mass and radius of the PSR J1416-2230 pulsar are used. It is found that all the obtained solutions exhibit physically viable and stable behavior. © 2025 Elsevier B.V., All rights reserved.