Zend certified PHP/Magento developer

When should i use UDP and when should i use TCP?

import scapy.all as scapy
test = scapy.IP(dst='8.8.8.8')/scapy.UDP()/scapy.DNS(qd=(scapy.DNSQR(qname='www.gmail.com')))
answer = scapy.sr1(test)['DNS']['DNSRR'].show()

I know UDP is used for faster connection of lossy content but i don’t understand the usage here

Is the UDP parameter here used to transfer the gmail webpage quickly by the google 8.8.8.8 dns server or by using UDP i asked google dns server to just load the page no matter how it has been loaded ? am i right or wrong ?