You need to account for the depth of the text below the baseline.
\documentclass{article}
\usepackage{xcolor,calc,trimclip}
\begin{document}
\newlength\myl
\newlength\myh
\newlength\myd
\newcommand{\bicolor}[1]{
\setlength{\myl}{0pt-\widthof{#1}}%
\setlength{\myh}{\heightof{#1}}%
\setlength{\myd}{\depthof{#1}}%
\raisebox{0.5\myh}{\color{red}\clipbox{0pt {0.5\myh+\myd} 0pt 0pt}{\mbox{#1}}}%
\hspace{\myl}%
{\color{blue}\clipbox{0pt 0pt 0pt {0.5\myh}}{\mbox{#1}}}%
}
\bicolor{BiKolor stuff}
\bicolor{BiKolor$_2$}
\end{document}
Note that you lose a little bit of the "ff" font glyphs from clipping, because of font protrusion or "overshoot" (see What is the local height of a capital letter?). You can clip to -1pt on those boundaries to compensate, if desired.
However, if you clip -1pt
on the left and right borders, it will make the result 2pt wider, so you need to \hspace
leftwards 1pt at the start and end of the process. In the MWE, I show with and without bi-color to compare results.
\documentclass{article}
\usepackage{xcolor,calc,trimclip}
\newlength\myl
\newlength\myh
\newlength\myd
\newcommand{\bicolor}[1]{\hspace{-1pt}%
\setlength{\myl}{0pt-\widthof{#1}}%
\setlength{\myh}{\heightof{#1}}%
\setlength{\myd}{\depthof{#1}}%
\raisebox{0.5\myh}{\color{red}\clipbox{-1pt {0.5\myh+\myd} -1pt -1pt}%
{\mbox{#1}}}%
\hspace{\myl-2pt}%
{\color{blue}\clipbox{-1pt -1pt -1pt {0.5\myh}}{\mbox{#1}}}%
\hspace{-1pt}}
\begin{document}
BiKolor stuff
\bicolor{BiKolor stuff}
\bicolor{BiKolor$_2$ Xg jRETY}
BiKolor$_2$ Xg jRETY
\end{document}