Halogens bonded to benzene ring has three lone pairs. These three electron pairs can cause resonance in benzene ring. But, halogens are also highly electronegative and thus they have strong -I effect. So, they are deactivating groups. But, why are they ortho para directing?
Let's take as an example a typical halogen, chlorine. Chlorine withdraws electrons through inductive effect and releases electrons through resonance. Through the inductive effect, chlorine destabilises the intermediate carbocation formed during the electrophilic substitution
Image courtesy: NCERT Chemistry Class 11th
Through resonance, a halogen tends to stabilise the carbocation, and the effect is more pronounced at ortho- and para- positions. However, the inductive effect is stronger than resonance here, and causes net electron withdrawal and thus net deactivation. The resonance effect tends to oppose the inductive effect for the attack at ortho- and para- positions and hence makes the deactivation less for ortho- and para- attack.
Reactivity is thus controlled by the stronger inductive effect and orientation is controlled by resonance effect.
Firstly, halogen attached to a benzene ring is somewhat deactivating due to it's -I-effect, as a result it tends to withdraw the electrons from the benzene ring, making electrophilic substitution difficult. Next, due to resonance (as it has lone pair of electrons), there is an increase in electron density only at ortho and para positions with respect to the halogen. Hence, electron loving electrophile will be directed towards these positions. So, yes, they act as ortho and para directors.
As. ortho/ para directors are positively charged so halogens, being ortho/ para directors, are positively charged. This positivity is opposed by high electronegativity of the halogens which, make it difficult to orientate negative charge into tha ring. Thus it becomes difficult to add any substituent.
Halogen are unusual in effect on electrophilic aromatic substitution they are deactiviting yet or tho para directing . deactivation is characteristic of electron withdrawal ,where as ortha para orientation is characteristic of electron release . halogen show both characteristics electron withdrawal through , inductive effect and release through resonance effect and the two effect are evenly balanced.
We know that halogen have - I effect which deactivate the benzene ring but halogen are also carried +M effect which is produminished -i effect because +M effect is greater than -i effect and as we know that all +M-effect operating group are ortho and para directing because in case of +M effect operating group the more electron density are found in ortho and para possition hence further the electrophilic substitution the elecrophile attack in ortho and para position.