Latency is almost never a software issue, and almost always a hardware issue. Back in the good 'ol days of analog recording, the signal left your guitar (or mic, DI, whatever), went through the console, then the recorder, and back to your headphones at the speed of light. Nowadays in our digital world, the same trip happens at the "speed of processing". Unless you're listening to live through-put, ALL digital boxes will be affected by latency, because every time the signal goes through an A/D conversion, it takes time. Most home recording systems will offer latencies of between 64 to 128 samples as the lowest option. Nobody will ever notice that. However, as you start adding tracks (drums, bass, synth), the computer's processing power is split between playing those tracks back, recording your live signal, then spitting the whole affair back out to your headphones.
Here are a few tips:
Every software/hardware combo out there has a latency setting somewhere in the preferences menu. Check that first.
Overly high buffer settings can sometimes cause more problems than they solve, it's usually best to keep them at the factory default.
Make sure your computer is doing as little work as possible other than recording your music ... turn off everything that you don't need. In fact, you may even want to create a system boot-up profile that ignores things like the internet port, wi-fi cards, or any other goodies you may have that will take away from the CPU.
If you find your sessions are getting a little track-heavy, and that is what's causing the latency, try bouncing everything to a "temp mix" of 2 mono or 1 stereo track, and record to that. You can then import those tracks with everything else when you're ready to mix.
Good luck!