WITH A B18B ENGINE

1992 Acura Integra

I have a 1992 integra with a b18b engine that I bought used. I have been having numerous problems ever since I bought and it has been giving me a big headache.
the problem is the car idles normally around just under 1k, but randomly it will go lower than like 500 almost to the point where the engine has a chance of shutting off. This kind of scares me. Another issue I see is when im driving and switching gears sometimes the acceleration feels very weak and it takes a while for the engine to kick in, but I seem to notice it mainly on the 2nd gear.
Please help me!