At a bus stop, suppose the interval between two buses (bus headway) is $x$, PDF of $x$ is $f(x)$. The in-stop waiting time for a passenger is $y$. For a bus interval $x$, suppose the arrival of passengers satisfies uniform distribution with PDF:
$$ g(y|x) = \begin{cases} 1/x, & \text{if $0 \le y\le x$}\\ 0, & \text{otherwise} \end{cases}. $$
To derive the PDF of $y$ without the intermedia $x$, there is $$p(y) = \int_0^{+\infty}g(y|x){f(x)}dx = \int_0^{x}{\frac{1}{x}f(x)}dx $$
Here is the problem. $p(y)$ should be a function of $y$, but why the rightmost of the equation above is only a function of $x$, not $y$?
Yes, it should be a function of $y$, so clearly you have the bounds muddled up. $x$ should not appear there.
Look to the support for $g(y\mid x)$, it is $0\leq y\leq x$, so when "integrating out" the $x$, that leaves: $0\leq y$ as the support, and the integral is over $x$ from $y$ to infinity.
$$p(y)~{=\int_0^\infty \left(\frac 1x\mathbf 1_{0\leq y\leq x}\right) f(x)\mathsf d x\\= \mathbf 1_{0\leq y} \int_y^\infty \frac{f(x)}{x}\,\mathsf d x}$$
Of course, also the support for $f(x)$ itself needs to be considered.