I understand you essentially can't load any websites with Safari on your Mac, and other apps requiring Internet communications aren't working either, except for Mail.
Are you using a VPN? If you are, try not using it.
Otherwise review all the suggestions in If Safari doesn't open a page or work as expected on your Mac - Apple Support. Even though it discusses Safari specifically, review all of those suggestions. Some of them are applicable to connection problems in general.
Restart your Mac if you haven't already.
Try "Safe Mode": Use safe mode on your Mac - Apple Support
Needless to say, if you are using any non-Apple "anti-virus", "cleaning", or "Internet security" products including "banking security", anything at all in that broad category of utterly useless garbage, don't. A lot of things won't work if you do.
That's about all the suggestions I have at the moment, but if you don't get anywhere by all means write back.