You can use [`FunctionDomain`](https://reference.wolfram.com/language/ref/FunctionDomain.html) and [`FunctionRange`](https://reference.wolfram.com/language/ref/FunctionRange.html):

    FunctionDomain[Tan[x], x]
>    1/2 + x/π ∉ Integers 

    FunctionRange[Tan[x],x,y]
> True 

    FunctionRange[Sin[x], x, y]
> -1 <= y <= 1 


**Update** on questions in comments:

 - _**how the answer $1/2 + x/π ∉ \mathbb{Z}$ is related to the right result $ x ≠ π / 2 + k π $?**_

The two expressions are equivalent: Move $\pi/2$ to the lhs and divide both sides of the second expression by $\pi$ to get $ x/π - 1/2  ≠ k $ ($k$ integer).

 - _**Why does Mathematica return the first expression (not the second) as the answer?**_

The first one is _simpler_ by `LeafCount`:

    1/2 + x/π ∉ Integers // LeafCount
>   11

    ForAll[k, Element[k, Integers], x != k + π/2] // LeafCount
>   14