Best thing to do when using different versions of a same gem is to use either rbenv or RVM to create different gemsets for each project. This way You can be sure that your project won't load by mistake another version .
I personally use RVM so i am going to let You know how to use it.
1) install RVM from here https://rvm.io
2 ) make sure You are loading RVM in your .bashrc or .bash_profile files from your home directory ( /home/your_username) . You can use this code:
export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
3) take a look at this page https://rvm.io/workflow/projects and choose how You want to set RVM for your project . i personally use .rvmrc because i am old school...but those are not recommended anymore because they need trusting and are slower. As a alternative You can use .ruby-version and .ruby-gemset files. But You can use .versions.conf also If You want. Let's say for now we choose to use .ruby-version and .ruby-gemset files.
4) cd into your project and run this command `rvm --ruby-version use 2.3.3@project1 --create' . This will generate those two files în your project . And everytime You will cd into this project RVM will pick-up the gemset automatically.
5) Do the step 4) for the second project also but replace 'project1' with 'project2' .
6) Now You can edit the Gemfiles of these two project and put the version of rails that You desire.
7) to install each project You need to cd into that directory and run command 'gem install bundler' ( only first time) and then You can safely do 'bundle install'
8) repeat 7) for second project.
9) You are all Done. Now You have different version of same gem in two different gemsets .
To also answer the other questions:
1) having în the same gemset multiple versions of same gem can lead to conflicts especially when doing 'rails new project ' from terminal since this doesn't require a specific version . I suggest to create different gemset before installing a new version of a existing gem on your machine. For example for this particular case we can do this
rvm use 2.3.3@rails5 --create
gem install bundler
gem install rails -v 5.O.0.1
And now we can safely do 'rails new project' . This way the new version of rails is inside a new gemset .
I Hope this will help You :)