IP itself doesn’t guarantee delivering data correctly. It leaves all data protection to the transport protocol. Both TCP and UDP have mechanisms that guarantee that the data they deliver to an application is correct.
Using the IP layer, the correct destination of the packet is identified & delivered. The Transport layer protocols(TCP/UDP) check if the data delivered is correct using the Checksum mechanism. However, if the destination IP is not alive, the packet is hopped by decreasing the TTL (Time to leave) field and when it becomes zero, the packet is lost and undelivered. If the transport layer is UDP, the source doesn’t know of the failure in the delivery of the packet. For more details please refer IP address