Dimmesdale needs to escape from Chillingworth because Chillingworth knows that Dimmesdale is Pearl's father. Chillingworth has been persecuting Dimmesdale with this knowledge for much of the book.
Dimmesdale finally escapes Chillingworth in kind of a strange way. He confesses his sin in front of everyone. This takes away Chillingworth's ability to blackmail him. So Dimmesdale does not escape from Chillingworth by running away from him physically. Instead, he gets away by destroying Chillingworth's hold over him.
Once this happens, it is as if Chillingworth has lost his reason to live. He dies soon afterwards.