A DNS lookup turns a hostname into an address. A cached answer can remain in use until its time to live expires.
During the TLS handshake, the browser checks that the certificate covers the requested hostname and chains to a trusted authority.