Forcing with strange catcodes changes the standard behavior of _ and ^ is quite for sure a call to have problems down the way (TikZ? babel?). I also use a lot plain text subscripts; I suggest a semantic definition:
\newcommand{\tsub}[2]{#1_{\textrm{#2}}}
\newcommand{\maxval}[1]{\tsub{#1}{máx}}
(for example) and then you can use (notice that it's quite clear what the semantic is, and you have just one point of update if you want to change language...)
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\newcommand{\tsub}[2]{#1_{\textrm{#2}}}
\newcommand{\maxval}[1]{\tsub{#1}{máx}}
\begin{document}
$a+\tsub{b}{medio}=\maxval{c}$
\end{document}

(Yes, \textrm¹ and not \mathrm otherwise you can't use máx...)
¹ thanks @DavidCarlisle...
\newcommand{\tsub}[2]{#1_{\text{#2}}}then using\tsub{x}{subscript}--- it's quite semantically sound, imho. – Rmano Jul 11 '22 at 12:28\textthat makes a non-math region that picks up the current font from outside the math (eg it is italic is an italic theorem) – David Carlisle Jul 11 '22 at 13:42\textrm{}solve this? – iHnR Jul 11 '22 at 14:07\mathrmbut as Rmano notes you can't currently use that for accented letters, so textrm if you need that – David Carlisle Jul 11 '22 at 14:20