I currently have the following cases environment:
\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{lipsum}
\begin{document}
\lipsum[66]
\[
G(x,u) = \begin{cases}
-\dfrac{\cosh (\pi - x - u) + \cosh(\pi + x + u) - 2\cosh (\pi + x - u)}{4\sinh \pi} & \text{for \(0 \le x \le u \le \pi\)}\vspace{0.25em}\\
-\dfrac{\cosh (\pi - x - u) + \cosh(\pi + x + u) - 2\cosh (\pi - x + u)}{4\sinh \pi} & \text{\phantom{for} \(0 \le u \le x \le \pi\).}
\end{cases}
\]
\end{document}
but it produces a result that sticks out into the margin:
I think the natural way to fix this would be to intersperse the expressions and conditions in the following way (apologies for bad image editing, but hopefully it's clear what I mean):
Is there a straightforward way of achieving this with cases or similar?
This is similar to the desired output in this question, which used a hack to produce something along the right lines. But the answers in that case focused on splitting the expressions, which doesn't work well for me.