Markup is on cost, margin is on price
Both compare your profit with something else. Markup is profit as a share of what the job cost you. Margin is profit as a share of what you charge. A job that costs $100 and sells for $130 makes $30: that is a 30% markup, but a 23.08% margin, because $30 is less of $130 than it is of $100.