Taking something from the endowed money for the construction of a mosque and spending it on the poor
When an endowment (waqf) is for a specific, designated thing, such as a mosque and the like, it is not permissible to spend it on another purpose, except where the benefits of that endowed mosque have ceased, such that no prayer is offered in it because there is no population around it; in that case it should be transferred to another mosque through the relevant government department.
Reference: اللجنة الدائمة: 15920