Prevent the stretching of material?

this is an image when the (500x500x500 image) material is applied to a cube and not scaled.

here is an image when i scaled it one direction, how can i prevent it from being thicker on that side and all sides and always stay the same size around the mesh. so no matter how much i scale it, it will look like the lines on image one

That’s inherent in the stretching of the object. You stretch everything, including texture coordinates.
To make an object that you can resize, you have to build it in segments, and use a blueprint that replicates the center segment to make it as wide as you want it, without stretching any of them.
Or, alternatively, use a skinned/morphed mesh, where you have geometry for the start/end caps that is fully weighted to the start/end bone, and then blend between the bones in the middle.