You can use this phrase if you need to get through, for example, but you can’t get through someone because they are blocking your way. So you say “Excuse me.”
Or you can use this phrase if you need to get someone’s attention in a polite way. For example:
Excuse me sir, you dropped your wallet.
Excuse me, do you know what time it is?