Car flooded, check engine light- what do I do?

my poor little bug… it rides low, as new bugs do.
There’s been a tropical storm and it flooded all the nearby streets.
I drove out there today and it stalled. Wouldn’t start. My friend jumped it. We got it to start, and it sounded awful but I got it to drive home. It didn’t want to accelerate past 20 mph. I let it sit up on dryer ground for several hours and now it starts up and runs pretty good
but there’s still a check engine light!
my friend opened it all up and pulled out the sodden air filter and bought it a new one. Still has a light.
Still rattles a slight bit when the engine is idling.
Should I be worried?
I might have autozone do a free diagnostic….
any other advice?