Your trademark is protected while your application is pending, but you’re not enjoying the full protection that a registration guarantees.
Once you file, your filing date establishes priority over anyone who applies for an identical or confusingly similar mark after that date. In some jurisdictions, the examiner will pause a later similar application pending the outcome of yours.
This means that if your application is approved in the end, your rights run retroactively from the filing date. In line with that, the infringement that occurred during the pending period can be addressed after registration, as if you had been registered from day one.
What the pending period does not give you is the right to send a cease and desist letter or take formal enforcement action. Those rights require a completed registration. If a third party files a similar mark after yours, the appropriate response is to raise an opposition once their application is published, not to enforce directly.