Proverbs 15:29

The LORD is far from the wicked: but he heareth the prayer of the righteous.

The Lord stands far off and at a distance from the wicked, yet he hears the prayer of the righteous.
Being heard in prayer belongs with repentance and humility and dependence on God and a sincere desire for his presence, as seen in the self-righteous Pharisee set against the humble publican who asked for mercy and went home justified.
The verse that follows strengthens this, for turning away from God's law makes prayer an abomination.

That hearing is shown in answered prayers that spared Israel and restored a dead child to life and delivered Daniel and Peter from danger and brought release to prisoners.
Prayer is therefore to be offered continually and in faith in Jesus' name.
Those who have received God's favor should pray for discouraged sinners who are seeking rest, whose faith is stifled and who have not grasped the assurance of faith.