We investigate the effects of magnetic diffusion on the spectrum of ultra-high energy cosmic rays (UHECRs) from a cosmological perspective. To this end, we consider two modified theories of gravity (MTGs), namely, the gravity and a symmetric teleparallel gravity, also known as gravity. Utilizing these two MTGs, we calculate the suppression in the flux of UHECRs for a collection of sources. Non-evolution (NE) and cosmic star formation rate (SFR) scenarios have been considered in our calculation of the suppression factor. This study also includes a mixed composition scenario involving the nuclei upto iron (Fe). Furthermore, we provide a parameterization of the suppression factor for the proton and also for the mixed compositions within the and theories, considering both NE and SFR scenarios. The influence of the turbulent magnetic field on the suppression factor is also incorporated in our work. Comparative analysis of all our results with the standard ΛCDM model reveals significant effects of MTGs on the suppression factor that the power-law model predicts the lowest suppression factor, while the model predicts the highest, and interestingly the results from the standard model fall within the range predicted by these two cosmological models.