You can generally go by which action comes first. In 배달해 먹다, the delivery must happen first before you can eat anything, so 배달해 before 먹다.
Special helper verbs, such as 주다, 보다, 버리다, 받다, 두다, and many more. always come at the end.
- 몸이 아파 결근했어요 = I took a day off because I was sick. (becoming sick happens first causing you to call in sick)
- 소식을 전해 들었다 = I heard the second-hand. (전하다="pass on" happens before 듣다=the recipient hearing it)
- 연필을 서랍에 넣어 두었다 = I put the pencil in the drawer. (넣다=put in something, 두다=leave indefinitely)