How to create partial border without adding additional objects?

As shown, a partial border was created by adding padding to the main object. However, the padding also means the sides can’t be used to display anything (I have a slider and the knob is cut off). I can add a object below to simulate the border, but I think it is a waste of memory.