Rank of coherent sheaf on complex manifolds
To your first question: No, you can not in general assume that the rank of a coherent sheaf on a connected manifold is constant. In fact, vector bundles on connected manifolds are precisely the coherent sheaves with constant rank.
A little more involved example would be the cokernel sheaf of the following morphism. Let $B\subset \mathbb{C}^n$ be the unit ball and let $\phi\colon \mathcal{O}_B \to \mathcal{O}_B^n$ be given by $f\mapsto \left(z_1f,...,z_nf\right)$. The cokernel is coherent but not a vector bundle, since the cokernel is not free at $0$.
Explicitly, if it were a vector bundle then $\text{coker}\left(\phi\right)\cong \mathcal{O}_B^{n-1}$, since every holomorphic bundle over $B$ is trivial. And then the sequence
$0 \to \mathcal{O}_B \to \mathcal{O}_B^{n} \to \mathcal{O}_B^{n-1} \to 0$
would be spilt exact, meaning there would exist $g \colon \mathcal{O}_B^{n} \to \mathcal{O}_B$ such that $g\circ f = \text{id}$, which is clearly not possible.
To your second question: Even if your sheaf is torsion-free, the rank can still jump. One difference is that the singular set of a coherent sheaf has codimension at least $1$ and the singular set of a torsion-free coherent sheaf has codimension at least $2$. So for example, a torsion-free coherent sheaf on a connected complex $1$-dimensional manifold is locally free and thus has constant rank.
In general the rank of a coherent sheaf $F$ is upper-semicontinuous, i.e. for every $p\in M$ there exists an open subset $U$ such that $\forall q \in U \colon \text{rank}_q\left(F\right)\leq \text{rank}_p\left(F\right)$.
Edit: I realized your second question was not addressed by my answer, since you asked about the rank of torsion-free sheaf over its singular set. For this note that pullback preserves coherence and fiber rank is invariant under pullback. Hence again one can at most expect there to be a codimension $1$ subset in $Y$ such that $i^*_YF$ has constant rank away from this set. Here $i_Y$ denotes the inclusion of $Y$ in $M$.