Muslims are encouraged to pray for all Muslims
Although they have sins:
In Quran:
So know, [O Muhammad], that there is no deity except Allah and ask
forgiveness for your sin and for the believing men and believing
women. And Allah knows of your movement and your resting place. 47:19
And in Hadith:
It was narrated from Abu Ibrahim Al-Ansari, from his father, that: he
heard the Prophet say, when offering the funeral prayer for one who
had died: Allahummighfir lihayyina wa mayyitina wa shahidina wa
gha'ibina wadhakarina wa unthana wa saghirina wa kabirina (O Allah,
forgive our living and our dead, those who are present among us and
those who are absent, our males and our females, our young and our
old). Sunan an-Nasa'i 1986
When you do that you are doing something Angels do:
The heavens almost break from above them, and the angels exalt [ Allah
] with praise of their Lord and ask forgiveness for those on earth.
Unquestionably, it is Allah who is the Forgiving, the Merciful. 42:5
Allah is the wise and the Omniscient
It’s not risky to pray for the good of someone you don’t know, because if you do not know, Allah knows, and your prayer will be directed to the best, when you know that Allah knows everything and knows the secrets and the hidden, your fear should not take place.
It’s not cheap to pray for who whatever:
- it’s a sign that you care for all Muslims,
- it is the action of prophets and Angels
Nouh (pbuh)said:
My Lord, forgive me and my parents and whoever enters my house a
believer and the believing men and believing women. And do not
increase the wrongdoers except in destruction." 71:28
- It’s a way to gain a lot of hasanat :
Abud-Darda' (May Allah be pleased with him) reported: I heard the
Messenger of Allah (ﷺ) saying, "Whenever a Muslim supplicates for his
(Muslim) brother in his absence, the angels say: 'May the same be for
you too'."
[Muslim].
Your saying “Since this is common, it's probably okay to do” ...I say: this is a smart notice, and the wrong part for the thought process you followed I would say the assumption that you have control and what you pray for will happen as is, but this is not the case, Allah decides the best and if:
the prayer will be answered as is
by avoiding other bad fate
by bringing some other good.
Added to the person as hasanat
And Allah knows best.