Sentences of up to five years in prison could be handed out for dog theft after MSPs passed new legislation at Holyrood.