IP provides best-effort packet delivery. A router can encounter an expired lifetime, an unreachable destination, or a packet too large for the next link. The original sender needs enough feedback to understand what happened.
The Internet Control Message Protocol, or ICMP, carries that feedback. It also provides diagnostic request-and-response messages. Ping uses ICMP Echo messages to test reachability and measure round-trip time. Traceroute deliberately expires packets at successive routers and uses the resulting control messages to reveal a path.
ICMP is part of the network layer, not an application transport. It has no TCP or UDP port numbers. Blocking it indiscriminately can hide useful failures and break functions such as path MTU discovery and IPv6 neighbor discovery.