Suppose for a given function $f(x)$ we want to solve the inequation $x<f^{-1}(x)$. As you know the inverse of a function is its reflection over the line $y=x$. So I believe it kind of makes sence to say in places where $x<f^{-1}(x)$ then $f(x)<x$ because when the $f^{-1}$ is on top of the line $y=x$, its reflection -which is $f(x)$- is under the line. That's the case for some functions like $f(x)=0.5x+1$.
but if we take $f(x)=1/x$ this trick does not work because the inverse of the function is itself and where $x<f^{-1}(x)$ also $x<f(x)$.
I wanted to know if the above trick was just lucky or not and if not, are there any general rules to know if we can apply this trick to a certain function or not?


To start with, let's agree that it is certainly true that if $a = b$ then $f(a) = f(b)$, where $f$ is any function you like.
But when you try to solve $x < f^{-1}(x)$ by applying $f$ to both sides and claiming that $$f(x) < f(f^{-1}(x)) = x,$$ you are assuming that if $ a < b $ then $f(a) < f(b)$, where $a = x$ and $b = f^{-1}(x).$
For some functions it is indeed true that for any numbers $a$ and $b,$ if $ a < b $ then $f(a) < f(b).$ Such a function is called an increasing function.
The fact that we call some functions "increasing functions" should make you wonder if there are functions that are not increasing. And indeed there are such functions. There is such a thing as a function $g$ such that whenever $a < b,$ then $g(a) > g(b).$ The function $g(x) = 1/x$ on the positive real numbers is such a function. And it does exactly the opposite of what you want.
There can even be an invertible function that is neither increasing nor decreasing. consider the function $$ h(x) = \begin{cases} \dfrac2x & x > 0, \\[1ex] \dfrac x2 & x \leq 0. \end{cases} $$
You can confirm that this function is invertible. But $h(-2) < h(-1)$ while $h(1) > h(2).$ The first inequality says the function is not a decreasing function, while the second says it is not an increasing function.
So in general, if a function is increasing, then you can solve $x < f^{-1}(x)$ by solving $f(x) < x$; if a function is decreasing, you can solve $x < f^{-1}(x)$ by solving $f(x) > x$; but if the function is neither increasing nor decreasing then you must be more careful.