This question is inspired from another much easier problem I was trying to solve which I tried to generalize. The question is essentially as follows (assuming all the limits exist)
If $a\in \mathbb R\cup \{\infty\}$, and $f$ and $g$ are two functions such that $$\lim_{x\to a}\left|f(x)-g(x)\right|=0$$ and $\varphi$ and $\tau$ are functions such that $$\lim_{x\to \lim_{t\to a}f(t)}\left|\varphi (x)-\tau (x)\right|=0$$ then what is the least amount of conditions necessary to impose so that $$\lim_{x\to a}\left|\varphi\circ f(x)-\tau \circ g(x)\right|=0$$ can be concluded?
What about the special case $f=\varphi$ and $g=\tau$?
In the original problem I had, I was in the special case, and dealing with $a=\infty$ which is why I was only considering those cases. I was under the impression that the continuity of $g$ and the extra condition that $$\lim_{x\to \infty} |f(x)|=\infty$$ would be enough. But, I soon arrived at a counterexample: construct $f$ and $g$ such that $$\lim_{x\to \infty} f(x)= \lim_{x\to \infty} g(x) = -\infty$$ but $$\lim_{x\to -\infty} f(x) = 1,\quad \lim_{x\to -\infty} g(x) = 2$$ which shattered my hopes.
Also, it seems strange that there is very little (easily available) literature on such questions about composition of functions. So, does anyone know of any such result that deals with such a problem?
Link to MO post: https://mathoverflow.net/q/451283/311366