Regarding Miller compensation
How does it improves the unity gain bandwidth and phase margin both?

It doesn't improve the unity gain bandwidth; it reduces the unity gain bandwidth. It reduces it to avoid the prospect of the op-amp turning into an oscillator when negative feedback is applied.
However it does improve the phase margin by ensuring that the overall open-loop phase response does not slip towards 180° before the open-loop gain has dropped below unity.
Thus, when negative feedback is applied to the op-amp, the circuit does not turn into an oscillator: -

The compensation (blue) adds a pole at a low frequency and ensures that the uncompensated response (red) falls below unity gain before the phase angle has a chance to reach 180 °.