Both codes are in the Xcode Settings:
Both can be modified in the configuration file .plist of any Xcode project:
Both numbers can be used the same way. Both can hold the same number, but that is not the original propouse of Apple.
Regarding Apple documentation, these are the characteristics that must fulfill the version and buld numebrs:
Version usually are compund of one, two or three integer numbers separated by a coma:
As an example: version 1.1 is equal to the 1.0 version with some new functionality. Version 2 could be a big change in the functionality of the app: a bigger change, like a whole redesign.
If, as an example, some bugs are found in the version 1.2, we could fix those bugs and launch version 1.2.1.
Build usually is used as an incremental value to distinguish the installation packages independently of its version. It’s usefull when we had distributed different installation packages of the same version. This happends frequently in testing teams and distributing betas through out users. If we make beta tests of a particular version (like 1.3.1), we’ll have to know how to distinguish between a version created this last week and a package created last month of the same version. To avoid confusions is very useful to use a Build code.
In your Mac, click over the Xcode menu the first option “About Xcode” you’ll see both numbers: Version and Build. Example: Version 4.6.1 (4H512). Many other Apple apps use this scheme.
There are two important points regarding the upload of a new version. In the screens of iTunes Connect
Version is a number better changed manually each time functionality is added. However the Build increment can be automated using scripts.