When they're targeting different demographics, it doesn't matter. Only Square-Enix saw the money in the mobile gaming market and said "That's what we're gonna do and what we're gonna focus on." And it backfired on them big time, to the point that they've had to rethink their entire forward plan. Of course, when it comes to Square-Enix, it seems everything that happens to them is a surprise only to Square-Enix, because their corporate heads are too far up their own asses to see what everyone else can.
3DS is doing well because it's running Nintendo franchises, both the handheld standards like Pokemon and Animal Crossing, as well as more typically console fare like Legend of Zelda. Though the Vita isn't doing as well, it still has a solid collection of games that just don't happen to interest me, but they do interest other people*. Neither handheld is in danger of running low on quality software to the point that they'll only go for mobile games. Mobile gaming hits the same group who flocked to the Wii and never moved onto anything beyond Wii Sports. They're not into video games; they're into stuff to occupy their time. People into games will continue to buy games, and if they want them on a handheld on the go, they'll buy those. My wife has a 90-hour commute to work and then 2 hours back. She passes plenty of people on 3DS's each day, and it's nice for her to be able to play RPGs or neighborhood simulators like Animal Crossing and Tomodachi Life since she can't take Oblivion from home with her.
*except Persona 4 Golden. I'm now three episodes into the first Persona 4 anime and can see the fun game the story wraps around that I wish I could play.