2002 malibu not running well

My malibu starts and idles smoothly, but when I try to drive it surges and fades. It takes me a long time to get up any speed. The check engine light says that it’s the EGR valve. I replaced that along with the fuel filter without any improvement. help

The engine light can’t say that the EGR valve is bad. It can tell you that there is a problem in the EGR system.

What was the exact, specific code?

The check engine light says that it’s the EGR valve

No, it says it is seeing something strange about the EGR system. It only points to something that is not usual. After that, you need the mechanic to figure out the rest or you can end up replacing a lot of good parts.

Get the actual code(s). Get the exact code (like P0123) not just their translation into English and post it back here.

Actually it turned out to be a clogged catalytic converter. None of the codes on the check engine light related to that in the slightest

Yes, it probably did. If you got a code for excessive EGR flow, the most common cause of this code is a restriction in the exhaust system, normally the catalytic converter. The excessive back pressure will increase the flow through the EGR system to an unacceptable level. It is really unfortunate you replaced the EGR valve on this car. That is an awfully expensive part to throw at a problem you are not sure how to fix.