The fact that several unrelated apps are affected suggests that the issue may be occurring at the system level, but the exact cause isn't clear from the symptoms alone.
I would first unplug the headphones completely and test the Mac using its built-in speakers.
If the problem continues, start the Mac in Safe Mode by restarting while holding Shift.
If the problem disappears in Safe Mode, investigate software that loads during normal startup.
Because your 2017 MacBook Air is Intel-based, you can also try an SMC reset. Apple provides instructions for Intel Macs here: Apple Support — Reset the SMC.
It would also be worth testing with another keyboard, if available, and temporarily disconnecting other external devices.
Apple recommends disconnecting external accessories when troubleshooting hardware problems.
You can then run Apple Diagnostics. Shut down the Mac, turn it on, and immediately hold D until the diagnostic screen appears.
Apple provides the procedure here: Apple Support — Use Apple Diagnostics to test your Mac.
If you have installed third-party audio software or virtual audio drivers, check Audio MIDI Setup as well.
Apple's documentation is here: Apple Support — Audio MIDI Setup.
If the problem continues after these tests, particularly if it also occurs in Safe Mode and Apple Diagnostics reports an issue, having the Mac professionally diagnosed would be the next reasonable step.
Have the computer evaluated by the Professionals who have the Special Hardware Software and Expertise to diagnose the issue and offer possible solutions
Make an Appointment at the Apple Genius Bar or call 1 800 MyApple and have them evaluate the computer
Other location Call Centres
Contact Apple for support and service
Apple notes that Diagnostics can help identify potential hardware problems but does not test software conflicts. (support.apple.com)
I would not reinstall macOS yet.