The infinitive sounds more factual. In the first sentence, "to do something" will probably be interpreted as an adverbial phrase that modifies the verb "take":
"It took him an hour to do the dishes" states a fact: the amount of time it took him to do the dishes.
Present participles paint pictures. They are DESCRIPTIVE.
In the second sentence "doing something" will most likely be interpreted as adjectival describing "time". It describes how the time was spent. It works well in a sentence like
"He really took his time doing the dishes"
This paints a picture. When you hear this sentence, you can almost see him doing the dishes.
To some extent, you can use them interchangeably, but they do feel different.