97 Chevy Malibu hesitating and occasionally knocking

My 97 Malibu (6 cylinder) is starting to hesitate when I accelerate (frequently but not always) and sometimes I hear a sound like a card on a bicycle wheel - a knock/click sound while driving. What is wrong?

Low fuel flow through a dirty fuel filter can cause hesitation during acceleration.
Using a lower octane fuel than recommended can cause a clattering sound in the engine.