The dukedoms of Cornwall and Lancaster are 'odd'.
Lancaster passes directly from monarch to monarch, and has done since 1399. Cornwall is rather more complicated. Each heir apparent (normally eldest son of the monarch, but can be a male line grandson), becomes Duke of Cornwall at birth or on parent's accession if later. On each Duke's accession, the dukedom passes to his heir apparent if there is one, otherwise it 'merges with the Crown' until there is an heir apparent. So Edward VII was Duke of Cornwall from birth. On his accession, his heir apparent, the future George V, became Duke of Cornwall, to be followed by the future Edward VIII. Edward VIII had no heir apparent, so the dukedom merged with the Crown on his accession, and remained so until Elizabeth II succeeded on 6 February 1952, at which point her three-year-old son Charles became Duke of Cornwall, and remains so.
York is a conventional dukedom and should pass from father to son in the ordinary way. However, six Dukes of York have succeeded to the throne themselves, so that the dukedom has merged with the Crown and later been regranted, and most of the others have failed to produce sons. The only one who did was the very first Duke of York, Edmund, a younger son of Edward III. He was succeeded on his death by his elder son Edward, who died at Agincourt (he was found face-down in the mud after the battle without a mark on him, and it is surmised that he either souffoucated or had a heart attack). Edward had no legitimate children, so was succeeded by his nephew Richard, who was the father of Edward IV and Richard III. The present Duke only has daughters, so unless he marries again and surprises us it looks as though the dukedom will once again become extinct on his death (and available for either Prince Harry or William's second son if he has one).
Ann