Microsoft.Data.SqlClient is the replacement for System.Data.SqlClient. they have the same api, but the new version is getting the new features. Not sure what you mean when you you say mssqlconnection. in both libraries its (assuming the namespace using)
using var conn = new SqlConnection(connectionString);
your error sounds like you are not using trusted certificates on the sqlserver, so need you need to add TrustServerCertificate=true; to the connection string.