Doing $\sin\to-\cos$ with CDF causes trouble (cumulative distribution function) CDF let's you check if your final equation for $x$ is correct. You do this by calculating $F(x)$ for $D = 0$ and $D = 1$.
In my example:
Perform CDF on: $\;A\!\cdot\!\sin(5x-\pi/2)$, range: $<\pi/10, \pi/5>$
First thing I did was change $\;\sin(5x-\pi/2)$ to $-\cos(5x)$ which finally results in:
$x = \dfrac{\arcsin(1-D)}5$
For $D = 0$ it equals $\pi/10$ (Good!)
For $D = 1$ it equals $0$ (Bad!)
The latter tells us that it is incorrect. The thing is, if I go back to the begginning and do not change $\sin()$ to $\cos()$ then the final equation is:
$x = \dfrac{\arccos(1-D)+\pi/2}5$
For $D = 0$ it equals $\pi/10$ (Good!)
For $D = 1$ it equals $\pi/5$ (Good!!!)
So, why is the $\,\sin\to-\cos\,$ causing the trouble? It's correct in terms of maths, isn't it?
 A: Let's try another example:
Probability density function $f(x) = B\sin\left(5x-\frac\pi2\right)$,
domain $\left[0, \frac\pi{10}\right]$.
Making the substitution $\sin(5x-\pi/2) = -\cos(5x)$, we find
$$
\int_0^{\pi/10} B\cdot(-\cos(5x))\,\mathrm dx
 = \left. B\cdot\left(-\frac15\sin(5x)\right)\right|_0^{\pi/10}
 = -\frac B5(1 - 0)=-\frac B5,
$$
therefore $B = -5$ and the CDF is
$$
F(x) = \int_0^x 5\cos(5x)\,\mathrm dx = \sin(5x)\Big|_0^x = \sin(5x).
$$
So let $D = \sin(5x).$ Now if we try to solve for $x$ by taking arcsin on each side we have $x = \frac15\arcsin(D).$
Then from $D = 0$ we get $x = 0$ and from $D = 1$ we get $x = \frac\pi{10},$
so all is good.
Now try it without the substitution.
$$
\int_0^{\pi/10} B\sin\left(5x-\frac\pi2\right)\,\mathrm dx
 = \left. -\frac B5\cos\left(5x-\frac\pi2\right)\right|_0^{\pi/10}
 = -\frac B5(1 - 0)=-\frac B5,
$$
therefore $B = -5$ and the CDF is
$$
F(x) = \int_0^x -5 \sin\left(5x-\frac\pi2\right)\,\mathrm dx
 = \left. \cos\left(5x-\frac\pi2\right)\right|_0^x = \cos\left(5x-\frac\pi2\right).
$$
So let $D = \cos\left(5x-\frac\pi2\right),$ and trying to solve for $x$ by taking arccos on each side we have $x = \frac15\left(\arccos(D) + \frac\pi2\right).$
Then from $D = 1$ we get $x = \frac{\pi}{10}$
but from $D = 0$ we get $x = \frac\pi5$, which is wrong
because the lower end of the range of $f(x)$ is actually $x = 0.$

Yet another example:
Probability density function $f(x) = K\sin\left(5x-\frac\pi2\right)$,
domain $\left[\frac\pi2, \frac{3\pi}{5}\right]$.
You can try this yourself; I bet you'll find that you get wrong results for $x$ whether you substitute or not.

The problem is not the substitution; the problem occurs when you try to solve for $x$ in an equation by taking arcsin or arccos of both sides without paying attention to what function you were really looking at in the first place.
The arcsin function can only return values in the range
$\left[-\frac\pi2,\frac\pi2\right],$ so if you apply it to a sine in order to try to recover what was passed to the sine function, you will get a correct answer only if what was passed to the sine function was between $-\frac\pi2$ and $\frac\pi2.$
The arccos function suffers a similar weakness; it gives the correct number back only if what was passed to the cosine function was between $0$ and $\pi.$
For example, for $f(x) = A\sin\left(5x-\frac\pi2\right)$,
domain $\left[\frac\pi{10}, \frac\pi5\right]$,
we find that $D = F(x) = 1 - \sin(5x).$
Therefore $1 - D = \sin(5x)$;
but because $x$ has to be between $\frac\pi{10}$ and $\frac\pi5,$
it follows that $5x$ has to be between $\frac\pi2$ and $\pi.$
The only value in the interval $\left[\frac\pi2, \pi\right]$
that is between $-\frac\pi2$ and $\frac\pi2$ is $\frac\pi2$ itself;
every other value is out of range.
So when you say $\arcsin(1 - D) = 5x,$ the only time this is correct is when
$5x = \frac\pi2$; every other case is wrong.
To put it another way, $\arcsin(y)$ is not the inverse of $\sin(\theta)$; it is the inverse of a function that is equal to $\sin(\theta)$ when
$-\frac\pi2 \leq \theta \leq \frac\pi2$ but is undefined for any other input value.
But you can define other "inverse sine" functions for different parts of the domain of $\sin(\theta).$
For example, if we define $g(\theta) = \sin(\theta)$ only when
$\frac\pi2 \leq \theta \leq \frac{3\pi}2,$
the function $g^{-1}(y) = \pi - \arcsin(y)$ is a true inverse function.
Applying this function $g^{-1}(y)$ in your method for
$f(x) = A\sin\left(5x-\frac\pi2\right)$
with domain $\left[\frac\pi{10}, \frac\pi5\right]$, you should find that
\begin{align}
D &= 1 - \sin(5x), \\
g^{-1}(1 - D) &= g^{-1}(\sin(5x)), \\
\pi - \arcsin(1 - D) &= 5x, \\
x &= \frac15 (\pi - \arcsin(1 - D)).
\end{align}
Then when $D = 0$ you get $x = \frac\pi{10}$
and when $D = 1$ you get $x = \frac\pi5,$ just as you desired.

But the really simple way to find the desired values of $x$ is just to
read them from the problem statement.
Given a probability density function $f(x) = A\sin\left(5x-\frac\pi2\right)$ with domain $\left[\frac\pi{10}, \frac\pi5\right]$, so $f(x)$ is zero everywhere else, the values you are looking for are as follows:
\begin{align}
D &= 0 & \implies && x &= \frac\pi{10} & & \text{because $\frac\pi{10}$ is the start of the interval $\left[\frac\pi{10}, \frac\pi5\right]$.} \\
D &= 1 & \implies && x &= \frac\pi5 & & \text{because $\frac\pi5$ is the end of the interval $\left[\frac\pi{10}, \frac\pi5\right]$.} \\
\end{align}
It's just that simple. If you get different results, it's because you made an error while trying to solve for $x$ in $D = F(x),$ and you should re-examine those calculations.
Personally I think you should not even do those calculations -- I think they are a waste of time and effort -- but if your teacher is really rigid about using their method then you may have to do it.
Perhaps rather than having to write out the exact form of an inverse function,
you might be able to just solve the equation once for the case $D = 1$
(that is, solve for $x$ in $1 = F(x)$) and then solve it again for the case $D = 0.$

NOTE: I called $\left[\frac\pi{10}, \frac\pi5\right]$ a domain rather than a range because a domain is the set of numbers that you feed into a function, whereas a range in the context of a function is the set of numbers that come out of the function.
And in your original problem, what you called
"range: $\left\langle\frac\pi{10}, \frac\pi5\right\rangle$"
tells us the interval $\left[\frac\pi{10}, \frac\pi5\right]$ of possible values of $x$ that are fed into the function.
Technically, I really should call this the support of the pdf,
that is, the set where the function gives non-zero values,
but when we deal with inverting a function we need it to have a domain.
