ไม this word is stand for "ทำไม Why"
Examples:
1) (ทำ) ไมไม่ทำแบบนี้ล่ะ? Why don't you do like this?
2) (ทำ)ไมช้าจัง Why are you so late?
ไหม= the question word, it indicates that a voluntary choice is possible, hence it is used in invitations, suggestions.
1)เรากำลังจะไปซื้อของกัน ไปด้วยกันไหม We are going shopping. (Do you) want to go along?
2)มีใครมางานวันเกิดบ้างไหม Is anyone coming to birthday party?
Hope my answers are helpful for you.