Derby County striker David McGoldrick says he contemplated retirement after being released by Sheffield United in the summer of 2022.