Lets say we send segment A with some data. Sender waits for ACK from receiver but there is timeout and sender send this segment (A) again. After this, sender received delayed ACK segment (B). What is now happening with duplicated data/ack packets?
In short, nothing. The connection resumes communicating. There is no duplicate data, only a duplicate segment. Each segment contains a sequence number that permits the receiver to discard duplicate data and re-order out of order segments so that the receiver sees the data stream as the correct sequence of bytes.