Hopefully you are still not running OS9 or lower. If you are, the best course of action may indeed be to buy a new machine, as the upgrade process will be substantial.
In any case, RAM is important, and in order to maximize the usage of your machine you will need to have as much installed as you can afford or fit in there. You can find out how much RAM you have by clicking the Apple Menu -> About this Mac. You are looking for the part that says "Memory."
10.6 Snow Leopard is Intel-only but 10.5 Leopard is still universal and so will work on a PPC machine with a G4 or G5 processor.
That means the OP's "best" choice is 10.4 Tiger, since 10.3 Panther does not support universal binaries as most Mac software is commonly distributed in said format now. But to complicate things, Tiger is not officially supported on the "Bondi Blue" iMac and OP will require the use of a third-party utility called XPostFacto in order to be installed. The usage of XPostFacto is not insubstantial. You should read the FAQ provided
here and note that you will need as much RAM as fits into your computer. 256MB of RAM is recommended but less may be acceptable.
While it's true that the operating system you use will dictate what you can and cannot use, you'll also find that switching browsers may enhance your browsing experience since some are more efficient at rendering than others.
As long as you are running Tiger you will be able to run the majority of software.
This is mostly important since the web browser you'll need is Opera. I have a bunch of older Macs that I've tested all the other browsers on, and Opera offers the best performance as far as I can tell. If you choose to take my advice to upgrade to Tiger, then all is good and you install Opera 10.
If you choose not to take my advice to upgrade to Tiger, and are using 10.3 Panther instead (which is simple to install), then try Opera 9 or iCab.
If you install Tiger, you will also want to update your Adobe Flash Player (if you need or use Flash, for YouTube, etc) to 10.1 or later. An important speed update was added in 10.1 that offers significant performance enhancements.
Or, as Flash Player is the hulking behemoth that often slows down your web experience (since it is also used for ads, etc), you may choose to disable it altogether (Opera provides a way to do so).
As a side note, I find it fascinating that Apple offers support for products up to five years old and considers a product "Vintage" if it is older than five and less than seven years old and "Obsolete" if it is older than seven years old.
OP's machine is nine or ten years old and apparently still in quite active service. I'll be chuffed if my advice helps it to become more useful again.