Does traceroute use UDP or ICMP or both?

ICMP creates and sends messages to the source IP address indicating that a gateway to the Internet that a router, service or host cannot be reached for packet delivery.

ICMP is not a transport protocol that sends data between systems.

ICMP messages are transmitted as datagrams and consist of an IP header that encapsulates the ICMP data.

ICMP packets are IP packets with ICMP in the IP data portion.

ICMP messages also contain the entire IP header from the original message, so the end system knows which packet failed