If your golf cart seems to run OK at first but later after some driving time starts acting up the batteries are the likely cause. You may feel the cart lurching forward erratically or give the feel of a car running out of gas.
The most common cause is one or more of your batteries has gone bad. Somewhere in the battery cell it is getting an incomplete connection along the lead plates inside the battery case.
You will sometimes smell the burning or melting from the limited connections and the added heat is melting metal.
Test each battery individually to check for a low current flow. Then replace the damaged battery with a new one. This cures 70% of all surging issues I run across.