Which attack occurs first: nucleophilic acyl substitution or nucleophilic substitution? If there is a compound with a site for nucleophilic acyl substitution (i.e. an ester group or the like) as well as a nucleophilic substitution (i.e. a bromine group or the like), will a nucleophile preferentially attack one of them? How do i decide which one a nucleophile would prefer attacking?
The answer is - it depends. On the conditions, on the solvent, on the nucleophile being used, on which ester is being used. You may get selectivity, you may get attack at both sites which generates a mixture.

In the real world of chemistry you often don't know for certain until you run the experiment unless someone has published an exact procedure for the transormation which you follow.