This has been happening for many years, probably since Multiplayer was added, and it's still unsolved.
Technically not a bug I guess, but it can get annoying.
When adding a Server IP on the Multiplayer menu, if by accident there's a space at the beginning/end of the IP, that'll count as part of the IP address and will make it impossible to join that server. It's not a huge issue, but sometimes it can be hard for Server administrators to recommend this if a player is having trouble joining their server because of how simple the issue is.
The solution is simple. Just automatically remove/ignore spaces on the IP address.
Linked issues
Comments 2
Thank you for your report!
We're tracking this issue in MC-242809, so this ticket is being resolved and linked as a duplicate.
That ticket has already been resolved as working as intended, which means this is not considered a bug and won't be fixed. Please do not leave a comment on the linked ticket.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
this may duplicate MC-242809 which was resolved as works as intended