Flalign* environment: Put two equations side by side and separate them with vertical line

What I want is putting two formulas/equations side by side. They should be clearly separated with a vertical line in the middle.

Here comes the code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tabstackengine,amssymb}
\usepackage{tikz}
\stackMath
\newcommand\udash[2][\hrulefill]{\stackunder{#2}{\makebox[0.7em]{#1}}}
\newcommand\mygap{\udash[]{}}
\newcommand{\myq}{\,\,\,}
\begin{document}
\begin{center}
$\langle\tabbedShortunderstack{ \udash{x}&\mygap&\udash{}\\ i&&}\rangle_k \langle\udash{}\mygap x \mapsto i\mygap\udash{}\rangle_{\mathrm{state}}$

$\rho_{r}:\langle\tabbedShortunderstack{ \udash{x}&\myq\curvearrowright&\udash{}\\ i&&}\rangle_k \myq \langle\udash{}\mygap x \mapsto i\rangle_{\mathrm{state}}$
\end{center}

\begin{flalign*} %diese sollen in der Mitte von einem vertikalen Strich getrennt werden
\rho_{r}:\langle\tabbedShortunderstack{
\udash{x}&\myq\curvearrowright&\udash{}\\ i&&}\rangle_k \myq
\langle\udash{}\mygap x \mapsto i\rangle_{\mathrm{state}}
&\myq\rho_{r}:\langle\tabbedShortunderstack{
\udash{x}&\myq\curvearrowright&\udash{}\\ i&&}\rangle_k \myq
\langle\udash{}\mygap x \mapsto i\rangle_{\mathrm{state}}
\end{flalign*}
\begin{tikzpicture}[overlay]
\draw[red] (0.5\textwidth,0.5) -- (0.5\textwidth,1.75);
\end{tikzpicture}
\end{document}


I will get following result:

Two questions: First, how can I adjust the lenght of the vertical line? Second, how can I adjust the distance between formula and line? It should be clear, what I mean.

Thanks!

You can use tikzmark for that. This allows you to draw the line exactly in the middle, and calc allows you to fix the length. The distance can be controlled by just adding \qquad, say, between the blocks.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tabstackengine,amssymb}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}
\stackMath
\newcommand\udash[2][\hrulefill]{\stackunder{#2}{\makebox[0.7em]{#1}}}
\newcommand\mygap{\udash[]{}}
\newcommand{\myq}{\,\,\,}
\begin{document}
\begin{center}
$\langle\tabbedShortunderstack{ \udash{x}&\mygap&\udash{}\\ i&&}\rangle_k \langle\udash{}\mygap x \mapsto i\mygap\udash{}\rangle_{\mathrm{state}}$

$\rho_{r}:\langle\tabbedShortunderstack{ \udash{x}&\myq\curvearrowright&\udash{}\\ i&&}\rangle_k \myq \langle\udash{}\mygap x \mapsto i\rangle_{\mathrm{state}}$
\end{center}

\begin{flalign*} %diese sollen in der Mitte von einem vertikalen Strich getrennt werden
\rho_{r}:\langle\tabbedShortunderstack{
\udash{x}&\myq\curvearrowright&\udash{}\\ i&&}\rangle_k \myq
\langle\udash{}\mygap x \mapsto i\rangle_{\mathrm{state}}\tikzmarknode{l}{~}
\draw[red] ($(l.north)!0.5!(r.north)+(0,5mm)$) --
($(l.south)!0.5!(r.south)+(0,-3mm)$);