Let me start off saying that making your own standoffs is not worth your time. These parts can be purchased for less than a dollar a piece and will be made with much better tolerances. I would recommend Mcmaster carr part #91780A063
This standoff uses 10-32 screws so you need to us that instead of M5, but the 10-32 screws are cheap because they are more common. I made these standoffs but will most likely replace them soon with the Mcmaster part. I made a jig to hold the tube with a set screw which allowed me to drill the ends with the drill press and hold the part while tapping. My results were not the best but close enough, and that's why I recommend just buying these parts.