One is documented with a discussion and the other is empty. A search of Apple's Async Algorithms shows that the one which starts with handler and operation next is always used. This is the variant which is not documented. It appears they behave the same and have a functionally identical signature for both closures. Should one be deprecated?
The Task API went through significant revisions throughout its development. The withTaskCancellationHandler(operation:onCancel:) version is the final version, and it benefits from multiple trailing closure syntax:
Task.withTaskCancellationHandler {
// this is your main block of async work
} onCancel: {
// this is your cancellation handler
}