Haven't read all replies so sorry if I repeat... or have misunderstood because your posts are a bit confusing. Eg. You say he's had his shoes off a while but then you say it was only 2 weeks ago? You say he was lame a couple of days, or a couple of weeks ago(?).
Most importantly, if your horse is lame & you don't know the cause & so whether your helping or hurting to work him, DON'T RIDE HIM!
If he's been lame for more than a week, I'd call the vet out. If he's only 5yo, I would not be doing things like barrel racing on him yet, if you want him to be sound long term. It could be that he has a back prob or such.
Neither would I generally put shoes on a horse under about 5-6yo minimum. Since they're off now, I'd keep it that way. But especially as he's been in shoes for (?) long & still not quite mature, he's going to need hoof protection, for a time at least, on rough/hard footing at least, which could well be the cause of the lameness - he could have got a bruise/abscess. I would do some study into hoof health, soundness, etc so you can be more informed about your choices & their effects.