You almost had it, but you could try

=(D7-C7)-((D7-C7)>=5)*0.5-((D7-C7)>=10)*0.5