If the train goes to (stops at) Algeciras to get to Gibraltar and then go through it again to get to Ronda, to me Algeciras makes more sense. By staying there you wouldn’t have to lug your luggage on a bus. It’s 20km (12mi) from Gibraltar and there is bus service. It is also a little larger than La Línea de la Concepción. The advantage of La Línea is its proximity to the rock. From most places in town a 20-25 minutes walk gets you to the border. In my opinion neither town has much to offer so it’s really a matter of personal preference.
Back when I lived in Spain La Línea was the closest one could get to Gibraltar. Spain and the UK were at odds so the border was closed. To get to Gibraltar one had to go over to Morocco then come back to it.