Let $V$ be the fixed volume of solution $A$. Let $100\alpha$ be the percentage of dextrose in $A$. Let $100\beta$ be the percentage of dextrose in the higher concentration solution $B$. And let $100\delta$ be the desired percentage of dextrose. So for example if we start with $700$ ml of $10\%$ dextrose, and we wish to pour in enough $40\%$ dextrose to make $15\%$ dextrose, then $V=700$, $\alpha=0.10$, $\beta=0.40$, and $\delta=0.15$.
Let $x$ be the amount of $B$ we should add to $A$. We will end up with volume $V+x$. The amount of dextrose in this quantity will be $(V+x)\delta$.
Let's find the amount of dextrose another way. An amount $V\alpha$ will come from $A$, and $x\beta$ will come from $B$, for a total of $V\alpha+x\beta$. So we have
$$(V+x)\delta=V\alpha+x\beta.$$
Rewrite this as
$$V(\delta-\alpha)=x(\beta-\delta).$$
Now solve for $x$. We get
$$x=V\frac{\delta-\alpha}{\beta-\delta}.$$
Remark: Because the multiplier $\frac{\delta-\alpha}{\beta-\delta}$ does not change if we multiply each of $\alpha$, $\beta$, and $\delta$ by a constant, we can think of, say, $25\%$ as $25$, as long as we are consistent.
Let us take the first of your examples. There $V=500$, $\alpha=0.05$, $\beta=0.50$, and $\delta=0.08$. But if we wish we can use $5$, $50$, and $8$. Then
$$x=500\frac{8-5}{50-8}.$$
Calculate. We get $x\approx 35.71$.