Any subsheaf of $\mathcal O_X$-modules $\mathcal F\subset \mathcal O_X$ on a scheme (or even on a ringed space) is an ideal sheaf.
All the other adjectives (rank-one, coherent, smooth, projective, irreducible,...) are irrelevant.
Also, you shouldn't believe that ideal sheaves must be of rank one or quasi- coherent :
On the spectrum $X=\text {Spec} R$ of a discrete valuation ring $R$, consider the ideal sheaf $\mathcal I$ with global sections $\Gamma(X,\mathcal I)=R$ and whose sections over the (open!) generic point are given by $\Gamma(\{\eta\},\mathcal I)=0$.
The sheaf $\mathcal I$ is an ideal sheaf which is not quasi-coherent and which is of rank zero .
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$.
Best Answer
Let $V$ be a space of global sections of $F$ generating $F$. If $v \in V$ is a general element, the corresponding morphism $v \colon \mathcal{O}_X \to F$ is injective. Let $$ F' := \mathrm{Coker}(v \colon \mathcal{O}_X \to F), \qquad V' := V / \langle v \rangle. $$ Then $F'$ is a coherent sheaf of generic rank $r - 1$ and $V'$ is a space of global sections of $F'$ generating it. Now the required result follows by induction.
EDIT. Indeed, by induction there is a subspace $U' \subset V'$ of dimension $r - 1$ such that the map $U' \otimes \mathcal{O}_X \to F'$ is injective. Let $U \subset V$ be the preimage of $U'$ in $V$, this is a subspace of dimension $r$. Then it is straightforward to check that $U \otimes \mathcal{O}_X \to F$ is injective.