Each layer encapsulates the higher layer in it payload (data), and each protocol has no idea, nor does it care, what is in its payload. The header of the protocol has a field to tell it where to deliver its payload.
For example, ethernet has the EtherType field that tells it to deliver its payload to the next process (layer), such as ARP, IPv4, IPX, IPv6, AppleTalk, etc. IPv4 has the Protocol field (IPv6 Next Header field is the same) that tells IP to which process to deliver its payload, such as ICMP, TCP, UDP, SCTP, etc.
TCP and UDP use ports to which an application process registers, and that tells TCP and UDP to which process to deliver the payload.