Gas caps are a wearable item. 135k miles with the factory one at almost 20 years old, it definitely won't hurt having it replaced. My understanding, they can fail one of 2 ways, either they stick open or shut, though sticking shut would probably require a physical failure that locks it in place, and the the car would eventually stall as the volume of gas dropping would create a vacuum and eventually mess with the fuel pump (if I understand it correctly, someone correct if wrong). Sticking OPEN, however, would mean it's constantly pulling air in and constantly leaking air/fumes out, and that will mess with the evap system. If you drive for 15 minutes at a good speed (step on it a few times as you want it to go through some gas) then pull over, and remove the cap. You should hear a swoosh as air enters. No swoosh, it's probably stuck open.
There are tools that can test a gas cap. Though if you pay to have it tested, the cost to test it will probably be more than just replacing it, and if it's bad, the cost of testing + new cap, will be even more.
It's smart to replace, then reset the code (pull battery cable or find someone that can reset with a scanner- even cheap scanners can reset) and drive it. If it comes back, start inspecting everything in the evap system, especially missing or broken vacuum connectors, rotted/split vacuum lines, etc..