Apple flesh is safe, but apple seeds contain cyanide compounds.
A few accidentally swallowed seeds are usually harmless, but consistently feeding cores or large amounts of crushed seeds is risky.
Apple seeds (and pear, plum, peach and cherry kernels) contain amygdalin which releases hydrogen cyanide when chewed. The seed coat normally prevents release if swallowed whole, but crushed seeds can deliver a meaningful dose, especially in small dogs over time.
Sources
Remove cores and seeds before sharing apple slices. A handful of crushed seeds in a small dog warrants veterinary advice.