An important distinction in the "set case" is that there are two things you can refer to when talking about "the category of groupoids":
- the 1-category of groupoids.
- the 2-category of groupoids.
It is important to distinguishes these two: In (1) the correct notion of "sameness" is the isomorphism of groupoids. In (2) it is the equivalence of groupoids. And (2) is exactly the Dwyer-Kan localization of (1) and "weak equivalences" (= Fully faithful and essentially surjective functors).
In particular, because the notion of sameness" isn't the same in both, it is somehow incorrect to consider the two have the same objects. I'll call the objects of (1) "pregroupoids" ("strict groupoids" is also a common name).
Now both (1) and (2) have natural general to the $\infty$-categorical or animated setting:
For (1): It is a kind of algebraic structure, and we more or less know how to weaken these: An "animated pregroupoid" is the data of an "Anima of objects" X, with "for each $x,y \in X$ an anima of morphisms $Hom(x,y)$" (I mean by that a functor $X \times X \to An$) equipped with a composition operation and an inverse operation that satisfies all the expected higher associativity and coherence conditions.
There are various way to make this definition formal (The simplest one being probably using the theory of Segal spaces) but at the end of day you can show (with more or less work depending on the definition you use) that there is an equivalence of category:
$$ \text{Animated pregroupoids} \simeq S \subset An^{\to} $$
Where $S$ is the full subcategory of things that are surjective on $\pi_0$. An arrow $f: X \to Y$ surjective on $\pi_0$ corresponds to the animated pregroupoids that has $X$ for anima of objects and for each $x,y\in X$ as $Hom(x,y)$ being the objects of path between $f(x)$ and $f(y)$ in $Y$.
So this is the analogue of (1) in the $\infty$-categorical setting.
Now for (2) : it corresponds to localizing the category at the appropriate notion of "weak equivalences".
If you think about it for a second, you'll see that the equivalence are exactly the square $(X \to Y) \to (X' \to Y')$ where the map $Y \to Y'$ is a weak equivalence. And so, contrary to the set theoretical case, when you localize the $\infty$-category of animated pregroupoids this way you can describe the localization very explicitly because the localization corresponds to a reflection (each $X \to Y$ goes to $Y \to Y$), and the localization is just the category of Anima. (so the $\infty$-categorical analogue of $(2)$ is just the category of Anima).
To some extent the fact that in the "animated" setting the "bicategory of (animated) groupoids" and the "category of set (=anima)" end-up being the same is a big reason (if not the main) why on many respect the theory of $(\infty,1)$-category behave better than ordinary category theory.