I can sympathize, mail on all my iOS devices (multiple iPhones and iPads) has been broken since iOS 18.
I've got a local IMAP server that has been in service for decades (even used the enterprise Mac email server that got deleted by an update then they made everyone pay for an app to re-enable it, then hosed everyone and discontinued it completely with no refunds or compensation) and I've never had any mail client issues with it (Mac and iOS Mail, Mac Thunderbird, Mac and iOS Outlook). The mail server I've been using (a packaged Dovecot IMAP server with SSL, just like the one Apple used) for years has automatically generated self-signed certs (which are a completely valid use case and are 100% a secure solution, despite what many would argue), and iOS 18 broke that because of their "we know better than you" attitude of not announcing anything before dropping support for self-signed certs.
So I rebuilt the whole thing as another Dovecot server (it already was, just a different packaged solution) using automated Let's Encrypt certificates. That fixed Mac and iOS Mail issues related to certificates until the first "update" broke it all again. So now my Mac's are using Thunderbird (which has always worked) and I'm still searching for something to put on all the iOS devices for family members to use. I spent all day yesterday screwing with iOS Mail settings, deleting and re-adding accounts with different settings, and it always looks like it's going to work then ends up failing.
It also seems like iOS caches bad/malfunctioning account information, or just knows that it has had an error in the past using that name that shows in the sidebar. If I re-add an account using the same name (even if the server name is different, like with and without domain or different domains that can get to the same server) it seems like the Mail account pulls bad information out of a cache and fails much faster than if it goes through a new account verification process with all the same settings, but using a different description for the account.
Yesterday, I had Mail working by adding a new secure IMAP account with a new name, switched to the Mail UI, tapped through every folder and let it download thousands of messages, then switched back to settings and it had a dialog sitting there saying it couldn't verify the identity of the server (which is normal, but usually happens before it lets you save the account information). The dialog showed all the certificate information and a SAN entry for the server address, and had the "Trust" link (which in one of the most aggravating failures by Apple from all iOS versions, isn't there when a new certificate gets issued, which is why everyone has to delete accounts and re-add them all the time instead of just being able to trust the new certificate) which tells the system it's OK to use this certificate for Mail (and you should be able to trust self-signed certs). So after all the time poking around in the Mail UI and everything working fine, I trusted the certificate and it broke the account with the same "Unable to create a secure connection to the server ("bad certificate format" -9,808)" error again -- SO, SO AGGRAVATING!