As said by TheTXI you can and should comment on both of the answers, and certainly upvote both.
Ultimately, when two answers are equally good but not the same, then you will have to choose between them, and you should decide based on which one helped you the most. If they both helped you equally, that means that neither one was a complete answer, and you should encourage either one of them to edit their answer to include the other steps.
The other critical part (which I've done in the past) is to edit your own question with a rejoinder that says
"EDIT: the answer was to do XYZ, which I learned from [link]abc's[/link] and [link]def's[/link] excellent answers."
If you specifically mention both, it is more likely that they will both get upvotes from it, because other people will see that they both have correct answers, even if the answers are not the same.
If select one as the accepted answer and do not mention the other, then the people reading the question will not know that you have to do both in order to fix the problem you were having.