\footheight
is total height of the foot, including height (space above the baseline) and depth (space below the baseline) of the foot.
Your rule starts on the baseline. So the height of the foot must be at least the height of your rule plus the depth of a \strutbox
. Therefore scrlayer-scrpage
enlarges the former \footheight
by \dp\strutbox
. On the next page your rule starts again on the baseline and so scrlayer-scrpage
enlarges the\footheight
from the last page by \dp\strutbox
again ...
You can shift the rule down by \dp\strutbox
:
\documentclass{scrartcl}
\usepackage[headsepline]{scrlayer-scrpage}
\ifoot*{\the\footheight\quad\rule[-\dp\strutbox]{2px}{\footheight}}
\usepackage{lipsum}
\begin{document}
\lipsum[1-40]
\end{document}

Or you have to shorten the rule \dp\strutbox
\documentclass{scrartcl}
\usepackage[headsepline]{scrlayer-scrpage}
\ifoot*{\the\footheight\quad\rule{2px}{\dimexpr\footheight-\dp\strutbox\relax}}
\usepackage{lipsum}
\begin{document}
\lipsum[1-40]
\end{document}

Or you can hide the height of the rule using \smash
\documentclass{scrartcl}
\usepackage[headsepline]{scrlayer-scrpage}
\ifoot*{\the\footheight\quad\smash{\rule{2px}{\footheight}}}
\usepackage{lipsum}
\begin{document}
\lipsum[1-40]
\end{document}

Note that
\ifoot*{\the\footheight\quad\rule[-\dp\strutbox]{2px}{\footheight}}
is a short version of
\ifoot
[{\the\footheight\quad\rule[-\dp\strutbox]{2px}{\footheight}}]
{\the\footheight\quad\rule[-\dp\strutbox]{2px}{\footheight}}