In your example, if you have five developers working on the same project, they will typically have five separate branches that they are working on. When those developers are ready to integrate their changes, they will typically open a pull request to merge their changes to the main branch.
At that point, if there are conflicts with the main branch, GitHub will warn that the change has conflicts, and won't permit it to be merged. If not, the developers can merge them in whatever order they like, and in each case, if the previous changes don't conflict with what's in the main branch as it progresses, they can be merged.
Note that GitHub never resolves merge conflicts itself. If there's a conflict, then someone with push access to the branch must resolve the conflicts and include an appropriate resolution. Until that's done, the branch won't be mergeable.
If users are all working on the same branch, then, by default, when pushing with Git, after the first change has been pushed, the server will realize that the push of the changes from the other developers is not a fast-forward. That is, the server side has commits that the client does not, and thus, the operation is aborted because to allow the push would override the existing changes. A thoughtful and considerate colleague would either push to another branch or communicate with their colleagues at this point.
However, having said that, a user can use a force push to overwrite those changes anyway and simply destroy them, replacing them with whatever's in the pushed branch. This can often be useful when a single person is working on a single branch and needs to rebase, which almost never leads to a fast-forward push.
In no event does a push result in a conflict. The result of a push is either a success because the push is a fast-forward, a success because the push isn't a fast-forward but it's a force push, or a failure of some sort.
As I mentioned above, practically, it's best to use pull requests with independent branches to make independent changes rather than all pushing to the same branch, since this results in fewer failed pushes and an easier workflow.