RSA and difference between factors As I understand, for RSA $n = p \cdot q$. For the key to be safe enough from getting factored, $p$ and $q$ have to be far from each other. How far do they have to be? For example, if I have two $1024$-bit primes that both start with a 1 and the difference between them $(p-q)$ is ~$1022$-$1023$ bits, is that good enough?
Yes, it is good enough. In the case of random primes the distance as large as the numbers with high probability.

With the recommended key-size ($2048$-bit) one only needs to generate two random primes of the right size ($1024$-bits each). This is generally done throwing a random number of $1024$ bits, forcing the first one and the last one bits equals to 1 (the Most significant bit is equal to 1 to guarantee the right size and the Less significant bit is equal to one to get an odd number) and check the primality of this integer. Sometimes the second most significant bit is set to 1, too. As  fgrieu explained in his comment mandating that the second highest-order bit of $p$ and $q$ is set insure that $N=pq$ has exactly as many bits as the sum of the numbers of bits in $p$ and in $q$, because $(\frac{3}{4})^2&gt;\frac 1 2$. That's not quite the way ANSI X9.31 and derivatives (including FIPS 186-4) RSA key generation methods do this; they tend to prescribe $2^{(n−1)/2}&lt;p&lt;2^{n/2}; 2^{(n−1)/2}&lt;q&lt;2^{n/2}$; and (w.r.t. Fermat/Lehman factorization) $|p–q|&gt;2^{n/2–100}$ where $n$ is the number of bits in $N=pq$, with $n$ multiple of $2^6$ or some higher power of two.