I know that when we first type an address on the URL and enter. The DNS query starts. I don't who initiates, but my guess is application will only initiate the DNS query. The DNS query already knows which IP to contact to get the information ( DNS server is preset). SO, the application will put the Domain name in the payload, the Transport layer will put as UDP or TCP ( I don't know , i.e.also the question), the src and destination IP will be put by Network layer. In DNS we already know the DNS server IP ( this is destination IP), a response will come back. This will be the destination IP. Now, the rest of the communication can happen. As we know that http is TCP. But, I don't know is DNS query a tcp or udp? Please correct my understanding also if you find something wrong here.
As many things, it depends.
DNS queries are generally handled over UDP. If you do an A record lookup for "www.google.com" (which is what happens when you go to www.google.com in your browser) the answer that comes back will be in a UDP packet.
If the query is for a large record (>512 bytes), like a big DKIM key, then the DNS request will use TCP.