the question is interested in the longer side

this means when you pick a random number inside the interval [0, 1], you will look to the left and to the right of the number, and you will choose the longer part

for example, you pick x = 0.3

you have 0.3 Left

you have 0.7 Right

you will choose 0.7 because it is longer

0.7 = 1 - 0.3

this is why there is l - x

if you pick x = 0.6

you have 0.6 Left

you have 0.4 right

you will choose 0.6

this is why you have x

one case it does not matter you choose left or right, when x = 0.5

the interval above can also be written as

l - x, 0 <= x < 0.5l

x, 0.5l <= x <= l

How do they get that interval?

They look for the critical point which in this case is 0.5 and they divide the interval between it!