This is an expandability issue paired with the fact that string manipulation is hard in TeX.
Essentially biblatex's \mkcomprange{<text>} only works as advertised if its argument <text> is a literal string. If the argument is too complex to be parsed correctly by \mkcomprange, \mkcomprange will simply do nothing. Not even
\newcommand\foo{23-24;34-35}
\mkcomprange{\foo}
works as one might hope, since \foo is not a string (it is a macro expanding to a string).
In
\mkcomprange{\StrBefore{23-24;34-35}{;}}
\mkcomprange does nothing, because its argument is too complex and only \StrBefore does its thing, leaving us with
23-24
and not the desired
23\bibrangedash 4
Coming back to the \foo example from above, the following works
\newcommand\foo{23-24;34-35}
\expandafter\mkcomprange\expandafter{\foo}
because the \expandafters make sure to expand \foo first before \mkcomprange sees it, so that \mkcomprange is not called with the argument \foo (which doesn't do the right thing, see above) but with 23-24;34-35 (which works).
Thinking further along those lines, one might try
\expandafter\mkcomprange\expandafter{\StrBefore{23-24;34-35}{;}}
Unfortunately, that fails spectacularly with all kinds of error messages. The problem here is that the command \StrBefore is not expandable, which means that it can not be massaged with commands like \expandafter (or in an \edef context) to just reveal the string directly.
The developer of xstring implemented a way of working around that: You can let \StrBefore write its output to a macro and use that. So the following again works
\StrBefore{23-24;34-35}{;}[\AVBtemp]
\expandafter\mkcomprange\expandafter{\AVBtemp}
For your simple requirements, you don't need xtstring at all. You can build something that splits your postnote at the ; yourself.
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear, backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}
\makeatletter
\newcommand*{\AVBpostnotesplitcompOne}[1]{\AVBpostnotesplitcompOne@i #1;\relax}
\def\AVBpostnotesplitcompOne@i#1;#2\relax{%
\ifblank{#2}
{\mkcomprange{#1}}
{\AVBpostnotesplitcompOne@ii #1;#2\relax}}
\def\AVBpostnotesplitcompOne@ii#1;#2;\relax{\mkcomprange{#1}}
\newcommand*{\AVBpostnotesplitcompTwo}[1]{\AVBpostnotesplitcompTwo@i #1;\relax}
\def\AVBpostnotesplitcompTwo@i#1;#2\relax{%
\ifblank{#2}
{}
{\AVBpostnotesplitcompTwo@ii #1;#2\relax}}
\def\AVBpostnotesplitcompTwo@ii#1;#2;\relax{\mkcomprange{#2}}
\makeatother
\begin{document}
\AVBpostnotesplitcompOne{Hallo}|\AVBpostnotesplitcompTwo{Hallo}
\AVBpostnotesplitcompOne{23-24;35-36}|\AVBpostnotesplitcompTwo{23-24;35-36}
\AVBpostnotesplitcompOne{23-24;}|\AVBpostnotesplitcompTwo{23-24;}
\AVBpostnotesplitcompOne{;35-36}|\AVBpostnotesplitcompTwo{;35-36}
\AVBpostnotesplitcompOne{23-24;35-36;46-45}|\AVBpostnotesplitcompTwo{23-24;35-36;46-45}
\cite{sigfridsson}
\printbibliography
\end{document}

\StrBefore{\mkcomprange{23-24;34-35}}{,}
doesn't work because because \mkcomprange is not expandable and so \StrBefore performs its actions on \mkcomprange{23-24;34-35}, where there is no comma to be found.
You may also be interested in Optional argument within another optional argument in biblatex \cite, where Audrey shows a way to split the argument structure of the postnote into different subarguments.
\mkcomparerangeand\StrBeforeare loaded? – muzimuzhi Z Mar 13 '20 at 02:52