There are some steps you should take before upgrading to the current version of OS X.
First, please run Software Update or the App Store and install all available updates for the OS you have now. The system should be in good working order. Don't expect an OS upgrade to fix a computer that is abnormally slow or unstable. More likely, the upgrade will make the problem worse.
If you have less than 4 GB of memory, as shown in the About This Mac box, and your model has upgradable memory, install at least that much, or preferably the maximum amount the machine can use according to Apple's specifications. If the memory is not upgradable, or if you don't want to upgrade it, defer using a newer version of OS X until you decide to buy a new computer.
If you've already upgraded the memory, check the specifications to make sure that the memory is compatible, both as to type and capacity. Never install more memory than the model officially supports. Aftermarket memory vendors may contradict Apple's specifications because they want to sell memory. Their assurances that you can exceed the specs are not to be trusted. Even if out-of-spec memory has been working, it may not work after the OS upgrade, or you may not be able to upgrade at all.
Check that all your most important third-party software is up to date and compatible with the current OS X. Very old versions of Microsoft and Adobe applications, for example, may not be compatible. The developer's website is the best source for that information. Incompatible third-party software is the cause of almost all problems with OS X upgrades.
Finally, back up all data, and be sure you know how to restore if the results of the upgrade are not to your liking.
If you have a spare storage device with enough capacity, you can copy the startup volume to it in Disk Utility, then start up from it and upgrade. Then, if you don't like the results, all you have to do is change the setting in the Startup Disk preference pane and restart. For details, search the built-in help of Disk Utility for the term "duplicate."