my question is what's the difference between the two interface commands and when to use one over another:
I am pretty confused about these two and when to apply them.
As far as I know :
Rate-limit works like policing , meaning there is no queue to prevent drops when your traffic exceeds the intended rate. they are either transmitted or droped (depending if bursting is allowed).
Of course you have the option of changing qos parameters when they exceed the allowe amount (like changing IP-Prec or DSCP).
on the other side shaping is used to prevent tail drops by buffering the excess traffic in a software queue.
I would add that policing can be used in both directions inbound and outbound but shapping only can be use outbound.
Just additional info, rate limit is a legacy implementation of policing which is supersede by police command.