How do employ ' ("prime") in math mode at the correct depth?

If you want subscripts to be on the same level, just add \mathstrut to them. A strut is an invisible thin vertical rectangle used in vertical spacing.

\int_{G^d} \varphi_{\mathstrut l,i} \varphi_{\mathstrut l',i'} dx

enter image description here

P.S. In addition to \mathstrut, \strut also works, but @Mico suggests below, using \mathstrut instead of \strut is better in math mode.


They're not smaller, but lowered less than the primed subscripts. Use a phantom, when you have to align subscripts.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\ul}{\underline{l}}
\newcommand{\ui}{\underline{i}}
\newcommand{\vp}{^{\vphantom{\prime}}}

\begin{document}

\[
\int_{G^d} \varphi_{\ul\vp,\ui\vp} \varphi_{\ul',\ui'}\,dx
\]

\end{document}

enter image description here