If FirstInt and SecondInt are your 2 integer variables, and Thresh is an integer variable indicating how much of a gap you want to allow (in your case 5), you can check for this gap in If condition FirstInt <= SecondInt AndAlso FirstInt + Thresh >= SecondInt. This checks that the first integer is equal to the second one, or no less than whatever Thresh is set to.
If you want the check to pass if the difference between FirstInt and SecondInt is a number like 5 regardless of which number is larger, (e.g. FirstInt can be 104 and SecondInt can be 99), then you need the If condition to be (FirstInt <= SecondInt AndAlso FirstInt + Thresh >= SecondInt) OrElse (FirstInt >= SecondInt AndAlso FirstInt <= SecondInt + Thresh).
Using a variable like Thresh allows you to easily configure the difference you want to accept between the values.
@BCdev
in such case the Math.Abs(i1 - i2) can also help as it takes the Absolute difference regardless if it is positive or negative. give a try
Math.Abs(i1 - i2) <= 5