Hi Tony,
First thing to do is get the car scanned for DTCs, or Diagnostic Trouble Codes. Anything that affects the car seriously enough to cause the kind of behavior you're seeing will set codes in the engine computer that should point you in the direction of the problem.
Here in the US, most auto parts stores will scan your car for free, or you can buy an inexpensive bluetooth scanner that will hook up to an app on your phone and do the scanning. You can find some of those OBD-II scanners for under $10 USD, and there are any number of free apps available; I use one called Torque.
While we wait for you to get your codes scanned, a check of the Hyundai forums shows that you're not the first one with that sort of problem. Here's one guy who found a solution when his car was doing that:
[link|https://www.hyundai-forums.com/threads/2006-3-5l-wont-accelerate-or-go-over-20-mph.113217/|2006 3.5l Won't Accelerate Or Go Over 20 Mph - Hyundai Forums|new_window=true]
[quote|format=featured]Looks like it was a loose connector to the throttle body (the one that is away from the firewall towards the front of the vehicle). Connector doesn't seem to have a retaining clip on it. Not sure if I broke it or lost it when I replaced the spark plugs this spring but certainly seems like it should have some kind of locking mechanism.[br]
[br]
I reset the codes by disconnecting the battery so we'll see if it comes back or not, but it is running fine after reseating the connector that seemed like it had worked it's way loose.[/quote]