Systems with both constant and time-varying delays: a switched systems approach and application to observer-controller co-design