Center text between double horizontal rules
You can use the same idea, but leaders don't work here, so I prepare a vbox with the double rules after computing their width.
Somewhat arbitrarily, the space between the rules is four times their thickness.
\documentclass{article}
\newcommand{\textbetweendoublerules}[2][.4pt]{%
\par\addvspace{\topsep}
\noindent\makebox[\textwidth]{%
\sbox0{\quad#2\quad}%
\dimen0=.5\dimexpr\ht0+#1\relax
\dimen2=-.5\dimexpr\ht0-#1\relax
\dimen4=.5\dimexpr\textwidth-\wd0\relax
\setbox2=\vbox to \ht0{%
\vss
\hrule width \dimen4 height #1
\kern 4\dimexpr#1\relax
\hrule width \dimen4 height #1
\vss
}%
\copy2 \box0 \box2
}\par\nopagebreak\addvspace{\topsep}%
}
\begin{document}
\textbetweendoublerules{abc}
\end{document}
I would go a different route and place the text in a coloured box over the lines. This way you don't have to worry about the centering.
(The code below is just a prove of concept, please adjust the lengths to your needs)
\documentclass{article}
\usepackage{lipsum}
\usepackage{xcolor}
\newcommand{\textbetweenrules}[1]{%
\begin{center}
\setlength{\fboxsep}{0.4cm}
\rule{\textwidth}{1pt}\\[-0.3cm]
\rule{\textwidth}{1pt}\\[-0.65cm]
\colorbox{white}{#1}
\end{center}
}
\begin{document}
\lipsum[1]
\textbetweenrules{Text}
\lipsum[2]
\textbetweenrules{longer text text text}
\lipsum[3]
\end{document}
It might be overkill to load TikZ for that, but if you load it anyway, you might consider this code:
\documentclass{article}
\usepackage{lipsum}
\usepackage{tikz}
\newcommand{\RuleText}[1]{%
\centerline{\tikz{\draw[double,line width=1pt,double distance between line
centers=3pt] (0,0)--(\linewidth,0) node[midway,fill=white]{#1};}}}
\begin{document}
\lipsum[1]
\RuleText{koala bear}
\lipsum[2]
\RuleText{marmot}
\lipsum[3]
\end{document}