You have two option to create a scale bar
What you do "normally" you fix the width of your segment in your map unit according to the scale you use and to have easy to use number "25 / 50 / 75 /100". If your map scale change your scale bar length in the print composer.
OR
You can set the segment size in your layout, this is the Fit segment width
option. If you set it to be 50 mm long in your layout no matter the scale used then you will get value that are not "round" (see picture below) that will be difficult to use for the map user and ugly (my opinion)
To do it better you have three different solutions :
- let the scale bar size change a bit. You set the segment width to be between two length that could fit in your layout. In my example I choose between 40 and 60 mm. All your pages will have approximately the same scale bar length (+ - 10 mm).
- fix your map scale. You set your map to be controlled by atlas but not the option
get margin around feature
but use the predefined scale (best fit)
option. Then set your predefined scale to match most atlas page.
- fake the round number. If you want no change in the scale used in the map neither to change the scale bar size then you can customize format number to round it. Warning this would be fake value. Go to Item properties of you scale bar, then Units and Customize. Below it is the 39,05 rounded to get only one significant number.
UPDATE FOR YOUR USE CASE
To use the solution number 1 you have to set the two values in yellow. The one in the top is used as the minimal dimension of a segment in your layout and the one below is the maximal size for your segment.
In your screenshot, we see that your legend element is 20 mm long. As you have two segments, the max size for each segment should be 10 and the minimal size should be 6 mm to keep segment visible. QGIS will choose the segment size to get a round number to show in map unit.