5. Define the length of the interval $\left[x_{1}, x_{2}\right]$ as $x_{2}-x_{1}$. If the domain of the function $y=\left|\log _{2} x\right|$ is $[a, b]$, and the range is $[0,2]$, then the difference between the maximum and minimum values of the length of the interval $[a, b]$ is $\qquad$ .
When the interval $[a, b]$ is $\left[\frac{1}{4}, 4\right]$, the maximum length is $\frac{15}{4}$; when the interval $[a, b]$ is $\left[\frac{1}{4}, 1\right]$, the minimum length is $\frac{3}{4}$. Therefore, the difference between the maximum and minimum lengths of the interval $[a, b]$ is 3.