score:6
As far as I know there is no such website or app that allows to book last-minute cheap flights. So you have to use any of the well-known services. In particular, the flight trip between Barcelona and Madrid (or viceversa) is known as "puente aereo" (literally "aerial bridge") and in general the cheapest company that operates this route is Vueling (13 flights per day). Prices starts from 50-70 € but it depends on the schedule.
Also the high-speed train is a good option and the bus is the cheapest option.