5. As shown in Figure 1, trapezoid $ABCD (AB \parallel CD \parallel y$-axis, $|AB| > |CD|)$ is inscribed in the ellipse.
$$
\begin{array}{r}
\frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}=1 \\
(a > b > 0), E
\end{array}
$$

is the intersection of diagonals $AC$ and $BD$. Let $|AB| = m, |CD| = n, |OE| = d$. Then the maximum value of $\frac{m-n}{d}$ is $\qquad$
5. $\frac{2 b}{a}$.

By symmetry, we know that point $E$ is on the $x$-axis.
Then point $E(d, 0)$.
Let $l_{B D}: x=k y+d$.
From $\left\{\begin{array}{l}x=k y+d, \\ \frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}=1,\end{array}\right.$ eliminating $x$ yields
$$
\left(a^{2}+b^{2} k^{2}\right) y^{2}+2 d k b^{2} y+b^{2}\left(d^{2}-a^{2}\right)=0 \text {. }
$$

Let $B\left(x_{1}, y_{1}\right) 、 D\left(x_{2}, y_{2}\right)$. Then $y_{1} 、 y_{2}$ are the roots of equation
(1), and $y_{1}<0<y_{2}$.
By Vieta's formulas, we get
$$
y_{1}+y_{2}=-\frac{2 d k b^{2}}{a^{2}+b^{2} k^{2}} \text {. }
$$

Then $m-n=-2 y_{1}-2 y_{2}$
$=-2\left(y_{1}+y_{2}\right)=\frac{4 d k b^{2}}{a^{2}+b^{2} k^{2}}$.
Thus $\frac{m-n}{d}=\frac{4 k b^{2}}{a^{2}+k^{2} b^{2}} \leqslant \frac{4 k b^{2}}{2 k a b}=\frac{2 b}{a}$.
The equality holds if and only if $\frac{a^{2}}{k}=b^{2} k$, i.e., $k=\frac{a}{b}$.