All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
There are various ways you can encourage good and forbid evil: including having patience, knowledge, and filling people's hearts with longing for what Allaah The Almighty has prepared for His righteous servants or with fear of what Allaah The Almighty has prepared for sinners. Other means include paying visits, good treatment, smiling at other people, offering religious tapes or books, or seeking others' help in this regard. All of this is summarized in the verse that reads (what means): {Invite (mankind, O Muhammad ) to the Way of your Lord (i.e. Islam) with wisdom (i.e. with the Divine Inspiration and the Quran) and fair preaching, and argue with them in a way that is better. Truly, your Lord knows best who has gone astray from His Path, and He is the Best Aware of those who are guided.} [Quran 16:125]
Practical Da‘wah (calling to Islam), i.e. to practice what you preach, is also a helpful means for achieving this purpose.
Regarding your second question, forbidding evil may occur in three degrees: firstly to change with your hand if you are able to do so; secondly to change it with your tongue; and thirdly, if you are unable to effect change via the first two means, it becomes obligatory on you to forbid the evil with your heart. Abu Sa‘eed narrated on the authority of the Prophet, sallallaahu ‘alayhi wa sallam, that he ordered anyone who sees evildoing to change it with his hand; if not, with his tongue; and if not, with his heart, which is the weakest degree of faith. [Muslim, At-Tirmithi, Ibn Maajah and Ahmad]
Scholars have also defined some conditions for forbidding evil:
-The evil must have been declared by the Sharee‘ah (Islamic law) as prohibited
-The evil must be actually occurring
-The evil must be overt, and seen without spying on the perpetrator
-The evil must not be a controversial issue where different groups debate whether the matter is prohibited or not.
If these conditions are fulfilled and you are able to forbid the evil with your hand or tongue and you fear missing the opportunity to effect change, which may inflict harm if you fail to act, then you are obliged to take the initiative to change the evildoing. According to Shaykh Khaleel the rule states that if there are many obligations to be observed at one time, the obligation that is likely to be missed must be given first priority.
If any of the above conditions do not exist then it is preferable for you to go to the prayers, because it is not obligatory for you to act to change the evil in this case. Moreover, if you are of those who are required to change the evil in the heart only, this does not contradict hastening to the mosque to perform prayer because doing so does not take much time.
If the situation is not likely to be missed or you cannot see a consequent harm, going to the prayers is preferable. Ibn Mas‘ood narrated that he asked the Prophet, sallallaahu ‘alayhi wa sallam, about the best thing to do. The Prophet, sallallaahu ‘alayhi wa sallam, told him that performing prayers at their due time. [Al-Bukhari, Muslim, At-Tirmithi, An-Nasaa'i, Ad-Daarimi and Ahmad]
The same thing applies to the second half of your second question: if you are able to effect change then you have to do it, even if this means you must continue your ride for some extra distance. If you are unable to effect change, you are not required to do it. Allaah The Almighty Says (what means): {So fear Allah as much as you are able.} [Quran 64:16]
Allaah Knows best.