Nucleophilic Substitution
A good leaving group can be replaced by an OH by reaction with water (hydrolysis) or with hydroxide, as weak and strong nucleophiles, respectively.
The hydroxide ion is a more powerful nucleophile - and a strong base! - than water and the substitution can end up very differently depending on the structure of the starting material.
In general, this method is not very useful for obtaining alcohols.
An important alternative is to perform the substitution with a precursor function of the hydroxyl group.
The OH remains LATENT during the first step of the reaction and is released in the second step.
In the first step, the carboxylate ion displaces the halide by an SN2 mechanism (in DMF, with heating) and an ester is formed: the oxygen of the future OH group is already bonded to the carbon, but "in disguise". In the second step, hydroxide attacks the carbonyl carbon of the ester (saponification): the acyl–oxygen bond breaks, the alcohol R–OH is released and the carboxylate ion is regenerated.
The carboxylate ion is a very good nucleophile but a very weak base. The substitution reaction gives much better results with this trick!
The much lower basicity of the carboxylate nucleophile greatly reduces the competition from the elimination reaction.
Let me insist! The lower basicity of the nucleophile avoids the usually strong competition from elimination, which would otherwise take over. Look at this practical example: