It seems the problem is with the certificate. With ODBC driver 18.0, the default value for the Encrypt is set to true. I recommend you to read the following blog post.
Try connecting the SQL Server instance by specifying no encryption. see the following part from the documentation that may help you.
The action item if you are affected by the Encrypt change is to either (in order of recommendation):
Install a trusted certificate on your server.
Change your client's Encrypt connection string setting (or connection property) to optional/no.
If you are using a self-signed certificate and the Force Encryption setting on the server to ensure clients connect with encryption, you will need to do one of the following (in order of recommendation):
Change to a certificate that is trusted as part of the client's trust chain.
Add the self-signed certificate as a trusted certificate on the client.
Change your client's TrustServerCertificate connection string setting (or connection property) to yes.
Refer: https://learn.microsoft.com/en-us/sql/tools/sqlcmd/sqlcmd-use-utility?view=sql-server-ver16