Basic and nucleophilic character of NaOH (aq)
Even if, The reagents you are using are the same for both substitution or elimination - the halogenoalkane and either sodium or potassium hydroxide solution. In all cases, you will get a mixture of both reactions happening - some substitution and some elimination. What you get most of depends on a number of factor. 

Nucleophilic substitution reaction has $\ce{SN2}$ reaction mechanism. 

For $\ce{SN2}$ favors the reaction with primary substituted alkyl halide more than secondary than tertiary, because its effected by steric hinderance. The more crowded it is, the more difficult it is for a nucleophile to attack. 

So, whatever you do with tertiary halogenoalkanes, you will tend to get mainly the elimination reaction, whereas with primary ones you will tend to get mainly substitution. 

For a given halogenoalkane, to favor elimination rather than substitution, use:

higher temperatures
a concentrated solution of sodium or potassium hydroxide
pure ethanol as the solvent

To favor substitution rather than elimination, use:

lower temperatures
more dilute solutions of sodium or potassium hydroxide
more water in the solvent mixture