بسم الله الرحمن الرحيم
According to Shariah the business of bidi is lawful though its use is makrooh. The mosque which your relatives have erected with the income of bidi it is lawful for you and other people to offer salah in that mosque without any doubt. Don’t doubt at all.
(Ahsan al-Fatawa 6/495, pub. Zakaria, Jadid Masail Ka Hal, p. 304, pub. Imdaiah Saharanpur, Fatwa Mahmoodia 16/ 126, Question: 7804, pub. Dhabe).
Note: However the business of bidi is not good. They should choose any other suitable and lawful business for their livelihood.
Allah knows Best!
Darul Uloom Deoband