I was able to solve it in a really easy way.
Just adding "pr: none" to my pipeline after the trigger.
So when there is a pull request it doesn't trigger before the end of the merge. Just when the merge is completed it triggers the pipeline after the branch receives the new changes.
I followed the microsoft documentacion from this link: https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/github?view=azure-devops&tabs=yaml#pr-triggers
trigger:
- <branch_name>
pr: none