We say an ordered set $S$ has the least upper bound property if every nonempty subset of $S_0$ of $S$ that is bounded above has a least upper bound.
Let $A = (-1,1) \subset \mathbb{R}$. Does $A$ have the least upper bound property? Well, let $A_0$ be any nonempty subset of $A$. If $A_0$ is bounded above, then $\exists a \in A$ such that $\forall x \in A_0, x \le a$. Now clearly, $x \le 1$, but $1 \not\in A$. So how do we we deal with this? We assume (or prove) $\mathbb{R}$ has the least upper bound property. So assuming that it does, then every bounded above subset of $\mathbb{R}$ has a least upper bound in $\mathbb{R}$. Clearly $(-1,1)$ is a bounded above subset of $\mathbb{R}$, since $\forall x \in (-1,1), x \le 1$, so it has a least upper bound in $\mathbb{R}$, but not in $A$?
Similarly, why doesn't $(-1,0)\cup(0,1)$ have the least upper bound property?
Considered as a subset of $(-1, 1)$, the set $(-1, 1)$ is not bounded.
The precise statement we are looking for is as follows:
Consider a partially ordered set $(A, \leq)$. A subset $B \subseteq A$ is said to be $(A, \leq)$-bounded from above iff there exists some $a \in A$ such that $\forall b \in B (b \leq a)$. When $(A, \leq)$ is clear from context, we just use the term “bounded from above”.
In particular, we see that $(-1, 1)$ is $(\mathbb{R}, \leq)$-bounded from above, since $1$ is an upper bound. However, $(-1, 1)$ is not $((-1, 1), \leq)$-bounded from above since there is no upper bound of $(-1, 1)$ in $(-1, 1)$.
The least-upper-bound property states that for all $B \subseteq A$, if $B$ is non-empty and $(A, \leq)$-bounded from above, then there is some $a \in A$ which is the least upper bound of $B$. In particular, $\mathbb{R}$ has the least upper bound property. Since $(-1, 1)$ and $\mathbb{R}$ are order-isomorphic, $(-1, 1)$ also has the least upper bound property.