If you are receiving this error it means that Minecraft is trying to connect you with an old server address. To resolve this issue, you need to open command prompt and type "ipconfig /flushdns". If you are on Mac then you'll just have to wait for iOS to refresh it's dns. Once you have flushed your DNS, please restart Minecraft completely and it should work fine.
If you are still having trouble connecting then I suggest your change your DNS server to use CloudFlare's, however this requires technical know how so be careful and don't make any changes you are unsure of. The instructions can be found at https://18.104.22.168/
Did this not work?
Create a support ticket, or contact a server owner to resolve this for you.