You mean playing best moves on both sides in a solo game? I think one good thing it helps with is your appreciation that your opponent has a plan as well and in a real game, you'll probably not play with blinders on and ignore what your opponent is doing.
Though your second question is easier => Of course playing against other human beings is better. I'd follow the progression from worst to best in terms of value to your chess playing.
1. Playing against a weaker player.
2. Playing against an approximately equal-strength player.
3. Going over the game post-mortem with equal-strength player.
4. Playing against a stronger player.
5. Going over the game post-mortem with the stronger player.
and best of all => 6.Having a good coach go over any game you play and identify mistakes and remedies for you.
Of course, playing weaker players is good in one sense => because you learn to practice winning won games, work on technique and ALSO practice NEVER underestimating them. Though you can't really make gains if all you ever do is beat up on people weaker than you.
What can you learn by playing against yourself?
Do you learn more or less than by playing against others?