I have a 1996 Lantra 1.8L 5spd manual Sports Wagon. For the last few months I had the same problem,
start engine...High Idle, then surging, 1200-1800 rpm, higher if the AC was on.
I took it into my local Hyundai dealer and they found that the air inlet manifold gasket had blown and was sucking in additional air causing all the problems. Creating a lean mixture then the O2 sensor would register too much and cause more fuel to be used. All up 1 problem causing two issues!
Only $325 (Aus Dollars) to fix and now it is perfect!
It is an easy fix book you car in and tell them about it!
Allister Stewart
March 2008