My 98 Honda civic is having issues with it's RPMS dropping to zero while driving or even idled?

When driving and this happens the car will not stall, none of the lights come on to indicate that there's no power, but it will not respond if I'm still pressing the gas, after about a second or two the rpms will jump back up and the engine will respond to the pedal. BUT if this happens when the car is stopped or at a low enough speed it will turn off. I've noticed this only happens when the car hasn't been run for longer than a few hours, enough time for the engine to cool down. It also seems to be exacerbated when it's extremely hot outside. I replaced the main relay that controls the fuel pump and all so I don't think that s the issue. The battery is also in good condition. But I need some second opinions here so I know where to start looking.

Could be a number of issues on those models… For some, it can be a bad distributor or ignition coil/module which can fail intermittently or when they get warmed up.

In other cases and most commonly, it can be due to a faulty ignition switch or main fuel pump relay. The ignition switch contacts can get worn and fail to send power to the ignition system, etc. At times which causes the engine to stall briefly… Or die at low speeds. Honda may have a recall on it too… Check for that. You can also try wiggling the ignition key with car in Park/engine idling… If engine stalls when wiggling the key, then likely the switch is bad… Replace switch… See video below on details/testing…

The fuel pump main relay can also go bad on those models… The solder joints inside the relay may be defective and open up when hot and cause a loss of power to the fuel pump… Causing the engine to stall or lose power briefly. Sounds like you already replaced the relay but check to be sure. A shop can also rig up a temporary testlight circuit in the pump power feed wire to see if the relay is losing power at times to the fuel pump when this situation occurs… If so, then replace relay or test pump circuit for other issues… Loose or corroded wiring, loose ground wire, etc…

Related articles… Similar stalling issues…
http://community.cartalk.com/discussion/2139123/1998-honda-civic-stalls-randomly

http://www.cargurus.com/Cars/Discussion-c2126_ds438877