The specific reason for this verse is for the children of Israel who used to boast in front of the Arab polytheists saying that a prophet will come and that they will believe in this prophet and they will kill them like what was done to Aad and Iram.
They did not know that the prophet will not be from them, rather he will come from the Arabs. Hence when he came to them, they disbelieved in him while they were the very ones who used to command the people on righteousness.
As for the general meaning, it is intended for all people, and for every caller to goodness amongst the scholars, the preachers, the leaders on the spiritual path and those who warn others and remind…
It is on these people to also do and remain steadfast on what they call others towards, as has been said by a poet:
“Do not prevent the creation (from something) while you do just like it,
The blame on you if you do so is immense”